Table of Contents

Class KeycloakWebAppAuthenticationBuilderExtensions

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

Extensions for the AuthenticationBuilder for startup initialization.

public static class KeycloakWebAppAuthenticationBuilderExtensions
Inheritance
KeycloakWebAppAuthenticationBuilderExtensions
Inherited Members

Methods

AddKeycloakWebApp(AuthenticationBuilder, IConfiguration, string, string, string, string?)

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

public static KeycloakWebAppAuthenticationBuilder AddKeycloakWebApp(this AuthenticationBuilder builder, IConfiguration configuration, string configSectionName = "Keycloak", string openIdConnectScheme = "OpenIdConnect", string cookieScheme = "Cookies", string? displayName = null)

Parameters

builder AuthenticationBuilder

The AuthenticationBuilder to which to add this configuration.

configuration IConfiguration

The configuration instance.

configSectionName string

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

openIdConnectScheme string

The OpenID Connect scheme name to be used. By default it uses "OpenIdConnect".

cookieScheme string

The cookie-based scheme name to be used. By default it uses "Cookies".

displayName string

A display name for the authentication handler.

Returns

KeycloakWebAppAuthenticationBuilder

The KeycloakWebAppAuthenticationBuilder builder for chaining.

AddKeycloakWebApp(AuthenticationBuilder, IConfigurationSection, Action<CookieAuthenticationOptions>?, Action<OpenIdConnectOptions>?, string, string?, string?)

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

public static KeycloakWebAppAuthenticationBuilder AddKeycloakWebApp(this AuthenticationBuilder builder, IConfigurationSection configurationSection, Action<CookieAuthenticationOptions>? configureCookieAuthenticationOptions = null, Action<OpenIdConnectOptions>? configureOpenIdConnectOptions = null, string openIdConnectScheme = "OpenIdConnect", string? cookieScheme = "Cookies", string? displayName = null)

Parameters

builder AuthenticationBuilder

The AuthenticationBuilder to which to add this configuration.

configurationSection IConfigurationSection

The configuration section from which to get the options.

configureCookieAuthenticationOptions Action<CookieAuthenticationOptions>
configureOpenIdConnectOptions Action<OpenIdConnectOptions>
openIdConnectScheme string

The OpenID Connect scheme name to be used. By default it uses "OpenIdConnect".

cookieScheme string

The cookie-based scheme name to be used. By default it uses "Cookies".

displayName string

A display name for the authentication handler.

Returns

KeycloakWebAppAuthenticationBuilder

The authentication builder for chaining.

AddKeycloakWebApp(AuthenticationBuilder, Action<KeycloakAuthenticationOptions>, Action<CookieAuthenticationOptions>?, Action<OpenIdConnectOptions>?, string, string?, string?)

Add authentication with Keycloak

public static KeycloakWebAppAuthenticationBuilder AddKeycloakWebApp(this AuthenticationBuilder builder, Action<KeycloakAuthenticationOptions> configureKeycloakOptions, Action<CookieAuthenticationOptions>? configureCookieAuthenticationOptions = null, Action<OpenIdConnectOptions>? configureOpenIdConnectOptions = null, string openIdConnectScheme = "OpenIdConnect", string? cookieScheme = "Cookies", string? displayName = null)

Parameters

builder AuthenticationBuilder

The AuthenticationBuilder to which to add this configuration.

configureKeycloakOptions Action<KeycloakAuthenticationOptions>

The action to configure KeycloakAuthenticationOptions.

configureCookieAuthenticationOptions Action<CookieAuthenticationOptions>

The action to configure CookieAuthenticationOptions.

configureOpenIdConnectOptions Action<OpenIdConnectOptions>
openIdConnectScheme string

The OpenID Connect scheme name to be used. By default it uses "OpenIdConnect".

cookieScheme string

The cookie-based scheme name to be used. By default it uses "Cookies".

displayName string

A display name for the authentication handler.

Returns

KeycloakWebAppAuthenticationBuilder

The authentication builder for chaining.