Table of Contents

Class KeycloakWebApiAuthenticationBuilderExtensions

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

Extensions for AuthenticationBuilder for startup initialization of web APIs.

public static class KeycloakWebApiAuthenticationBuilderExtensions
Inheritance
KeycloakWebApiAuthenticationBuilderExtensions
Inherited Members

Methods

AddKeycloakWebApi(AuthenticationBuilder, IConfiguration, Action<JwtBearerOptions>?, string, string)

Protects the web API 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 KeycloakWebApiAuthenticationBuilder AddKeycloakWebApi(this AuthenticationBuilder builder, IConfiguration configuration, Action<JwtBearerOptions>? configureJwtBearerOptions, string configSectionName = "Keycloak", string jwtBearerScheme = "Bearer")

Parameters

builder AuthenticationBuilder

The AuthenticationBuilder to which to add this configuration.

configuration IConfiguration

The configuration instance.

configureJwtBearerOptions Action<JwtBearerOptions>
configSectionName string

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

jwtBearerScheme string

The JWT bearer scheme name to be used. By default it uses "Bearer".

Returns

KeycloakWebApiAuthenticationBuilder

The authentication builder to chain.

AddKeycloakWebApi(AuthenticationBuilder, IConfiguration, string, string)

Protects the web API 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 KeycloakWebApiAuthenticationBuilder AddKeycloakWebApi(this AuthenticationBuilder builder, IConfiguration configuration, string configSectionName = "Keycloak", string jwtBearerScheme = "Bearer")

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.

jwtBearerScheme string

The JWT bearer scheme name to be used. By default it uses "Bearer".

Returns

KeycloakWebApiAuthenticationBuilder

The authentication builder to chain.

AddKeycloakWebApi(AuthenticationBuilder, IConfigurationSection, Action<JwtBearerOptions>?, string)

Protects the web API with Keycloak

public static KeycloakWebApiAuthenticationBuilder AddKeycloakWebApi(this AuthenticationBuilder builder, IConfigurationSection configurationSection, Action<JwtBearerOptions>? configureJwtBearerOptions, string jwtBearerScheme = "Bearer")

Parameters

builder AuthenticationBuilder

The AuthenticationBuilder to which to add this configuration.

configurationSection IConfigurationSection

The configuration second from which to fill-in the options.

configureJwtBearerOptions Action<JwtBearerOptions>
jwtBearerScheme string

The JWT bearer scheme name to be used. By default it uses "Bearer".

Returns

KeycloakWebApiAuthenticationBuilder

The authentication builder to chain.

AddKeycloakWebApi(AuthenticationBuilder, IConfigurationSection, string)

Protects the web API with Keycloak

public static KeycloakWebApiAuthenticationBuilder AddKeycloakWebApi(this AuthenticationBuilder builder, IConfigurationSection configurationSection, string jwtBearerScheme = "Bearer")

Parameters

builder AuthenticationBuilder

The AuthenticationBuilder to which to add this configuration.

configurationSection IConfigurationSection

The configuration second from which to fill-in the options.

jwtBearerScheme string

The JWT bearer scheme name to be used. By default it uses "Bearer".

Returns

KeycloakWebApiAuthenticationBuilder

The authentication builder to chain.

AddKeycloakWebApi(AuthenticationBuilder, Action<KeycloakAuthenticationOptions>, Action<JwtBearerOptions>?, string)

Protects the web API with Keycloak

public static KeycloakWebApiAuthenticationBuilder AddKeycloakWebApi(this AuthenticationBuilder builder, Action<KeycloakAuthenticationOptions> configureKeycloakOptions, Action<JwtBearerOptions>? configureJwtBearerOptions = null, string jwtBearerScheme = "Bearer")

Parameters

builder AuthenticationBuilder

The AuthenticationBuilder to which to add this configuration.

configureKeycloakOptions Action<KeycloakAuthenticationOptions>

The action to configure the KeycloakAuthenticationOptions.

configureJwtBearerOptions Action<JwtBearerOptions>

The action to configure JwtBearerOptions.

jwtBearerScheme string

The JWT bearer scheme name to be used. By default it uses "Bearer".

Returns

KeycloakWebApiAuthenticationBuilder

The authentication builder to chain.