Table of Contents

Class KeycloakAuthenticationOptions

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

Defines a set of options used to perform authentication

public class KeycloakAuthenticationOptions : KeycloakInstallationOptions
Inheritance
KeycloakAuthenticationOptions
Inherited Members

Fields

Section

Default section name.

public const string Section = "Keycloak"

Field Value

string

Properties

AdditionalAudiences

Gets or sets additional valid audiences accepted during JWT validation. Combined with the primary audience (Audience or Resource) to validate tokens issued for multiple clients within the same realm.

public string[]? AdditionalAudiences { get; set; }

Property Value

string[]

Examples

services.AddKeycloakWebApiAuthentication(options =>
{
    options.Resource = "api-client";
    options.AdditionalAudiences = ["billing-service", "reporting-service"];
});

Audience

Gets or sets the audience for the authentication. Takes priority over Resource.

public string? Audience { get; set; }

Property Value

string

DisableRolesAccessTokenMapping

Gets or sets the roles mapping from access_token mapping

public bool DisableRolesAccessTokenMapping { get; set; }

Property Value

bool

MetadataAddress

Gets or sets the metadata address used for server metadata discovery. When set, overrides the default OIDC discovery path derived from Authority. Use OAuthAuthorizationServerMetadataPath for RFC 8414 discovery.

public string? MetadataAddress { get; set; }

Property Value

string

Examples

options.MetadataAddress = KeycloakConstants.OAuthAuthorizationServerMetadataPath;

NameClaimType

Gets or sets the claim type used for the name.

public string NameClaimType { get; set; }

Property Value

string

OpenIdConnectUrl

Gets the OpenId Connect URL to discover OAuth2 configuration values.

public string? OpenIdConnectUrl { get; }

Property Value

string

RoleClaimType

Gets or sets the claim type used for roles.

public string RoleClaimType { get; set; }

Property Value

string