Class OpenIdConnectAuthenticationExtensions
- Namespace
- Microsoft.Extensions.DependencyInjection
- Assembly
- Stratara.Identity.AspNetCore.dll
Authentication-builder extensions for external identity providers — the interactive OpenID Connect sign-in flow and API JWT-bearer validation. Both are ordinary ASP.NET Core schemes (the provider seam is the scheme), so they compose with the cookie, API-key, and membership wiring already in this package. Entra, Keycloak, and generic OIDC differ only in configuration.
public static class OpenIdConnectAuthenticationExtensions
- Inheritance
-
OpenIdConnectAuthenticationExtensions
- Inherited Members
Methods
AddStrataraJwtBearer(AuthenticationBuilder, IConfiguration, string, string)
Register the API JWT-bearer validation scheme from configuration (default section
Identity:JwtBearer). List several authorities in ValidIssuers for a multi-issuer
API; the token's iss selects the trusted authority. The principal is keyed on the
issuer sub.
public static AuthenticationBuilder AddStrataraJwtBearer(this AuthenticationBuilder builder, IConfiguration configuration, string sectionName = "Identity:JwtBearer", string scheme = "Bearer")
Parameters
builderAuthenticationBuilderThe authentication builder.
configurationIConfigurationThe configuration root or section parent to bind from.
sectionNamestringThe configuration section to bind. Defaults to
Identity:JwtBearer.schemestringThe scheme name to register. Defaults to the JWT-bearer default scheme.
Returns
- AuthenticationBuilder
The same builder, to enable chaining.
Examples
Binds from Identity:JwtBearer by default and resolves the signing configuration per issuer:
services.AddAuthentication().AddStrataraJwtBearer(configuration);
AddStrataraOpenIdConnect(AuthenticationBuilder, IConfiguration, string, string)
Register the interactive OpenID Connect sign-in scheme from configuration (default section
Identity:OpenIdConnect). Pair it with a cookie scheme for the signed-in session and,
for first-time external users, AddStrataraExternalLoginProvisioning to create/link the
local account. The external login is keyed on the issuer sub, never on email.
public static AuthenticationBuilder AddStrataraOpenIdConnect(this AuthenticationBuilder builder, IConfiguration configuration, string sectionName = "Identity:OpenIdConnect", string scheme = "OpenIdConnect")
Parameters
builderAuthenticationBuilderThe authentication builder.
configurationIConfigurationThe configuration root or section parent to bind from.
sectionNamestringThe configuration section to bind. Defaults to
Identity:OpenIdConnect.schemestringThe scheme name to register. Defaults to the OIDC default scheme.
Returns
- AuthenticationBuilder
The same builder, to enable chaining.
Examples
builder.Services
.AddAuthentication(StrataraAuthSchemeSelectorOptions.SchemeName)
.AddStrataraOpenIdConnect(builder.Configuration)
.AddStrataraAuthSchemeSelector();