Table of Contents

Class KeycloakWebAppServiceCollectionExtensions

Namespace
Keycloak.AuthServices.Authentication
Assembly
Keycloak.AuthServices.Authentication.dll

Extension for IServiceCollection for startup initialization.

public static class KeycloakWebAppServiceCollectionExtensions
Inheritance
KeycloakWebAppServiceCollectionExtensions
Inherited Members

Methods

AddKeycloakWebAppAuthentication(IServiceCollection, IConfiguration, string, string, string, string?)

Add authentication with Keycloak This method expects the configuration file will have a section, (by default named "Keycloak"), with the necessary settings to initialize the authentication options.

public static KeycloakWebAppAuthenticationBuilder AddKeycloakWebAppAuthentication(this IServiceCollection services, IConfiguration configuration, string configSectionName = "Keycloak", string openIdConnectScheme = "OpenIdConnect", string cookieScheme = "Cookies", string? displayName = null)

Parameters

services IServiceCollection

Service collection to which to add authentication.

configuration IConfiguration

The IConfiguration object.

configSectionName string

The name of the configuration section with the necessary settings to initialize authentication options.

openIdConnectScheme string

Optional name for the open id connect authentication scheme (by default OpenIdConnectDefaults.AuthenticationScheme). This can be specified when you want to support several OpenIdConnect identity providers.

cookieScheme string

Optional name for the cookie authentication scheme (by default CookieAuthenticationDefaults.AuthenticationScheme).

displayName string

A display name for the authentication handler.

Returns

KeycloakWebAppAuthenticationBuilder

The authentication builder to chain extension methods.