string CookieScheme { get; set; }
Source
Gets or sets the cookie authentication scheme name.
Configures AppSurface conventions for ASP.NET Core cookie and OpenID Connect authentication registration.
These options name schemes, configure safe AppSurface defaults, and provide callbacks for host-owned ASP.NET Core handler options. They do not insert middleware, execute challenges, execute redirects, store users, provision app users, replace ASP.NET Identity, or configure provider-specific SDKs.
AppSurfaceOidcAuthOptions ConfigureCookie(Action<CookieAuthenticationOptions> configure)
Source
Adds host-owned cookie handler configuration.
configureCallback that receives the ASP.NET Core cookie handler options.The current options instance for chaining.
AppSurfaceOidcAuthOptions ConfigureOpenIdConnect(Action<OpenIdConnectOptions> configure)
Source
Adds host-owned OpenID Connect handler configuration.
configureCallback that receives the ASP.NET Core OpenID Connect handler options.The current options instance for chaining.
Provider values such as authority, client id, and client secret should be applied here. AppSurface diagnostics never copy those values into metadata.
AppSurfaceLoginPrompt CreateLoginPrompt(string? targetPath = null, string? displayText = null)
Source
Creates a passive login prompt for host-owned login UI.
targetPathOptional safe app-relative target path.displayTextOptional display text for the host UI.A passive login prompt that does not execute a redirect or challenge.
AppSurfaceLogoutPrompt CreateLogoutPrompt(string? targetPath = null, string? displayText = null)
Source
Creates a passive logout prompt for host-owned logout UI.
targetPathOptional safe app-relative target path.displayTextOptional display text for the host UI.A passive logout prompt that does not execute a redirect or sign-out.
void ApplyCookie(CookieAuthenticationOptions options)
Source
Applies registered cookie configurators to the AppSurface cookie handler options.
optionsThe ASP.NET Core cookie handler options registered for CookieScheme.Configurators run in the order they were added through ConfigureCookie(Action{CookieAuthenticationOptions}). Host values assigned by later configurators can therefore replace values assigned by earlier configurators.
void ApplyOpenIdConnect(OpenIdConnectOptions options)
Source
Applies registered OpenID Connect configurators to the AppSurface OIDC handler options.
optionsThe ASP.NET Core OpenID Connect handler options registered for OidcScheme.Configurators run in the order they were added through ConfigureOpenIdConnect(Action{OpenIdConnectOptions}) after package defaults are assigned, so host configuration can intentionally override default handler values.
void Validate()
Source
Validates AppSurface OIDC scheme names, subject mapping, and callback paths before registration.
ArgumentExceptionThrown when a scheme or subject claim is blank, a callback path is blank or unsafe, or CookieScheme and OidcScheme use the same value.Callback paths must be safe app-relative paths accepted by AppSurfaceOidcReturnUrlOptions.IsSafeAppRelativePath(string).
string CookieScheme { get; set; }
Source
Gets or sets the cookie authentication scheme name.
string OidcScheme { get; set; }
Source
Gets or sets the OpenID Connect authentication scheme name.
string SubjectClaim { get; set; }
Source
Gets or sets the stable subject claim that should be mapped into AppSurface auth context.
The OIDC package defaults this to sub, then delegates to AppSurfaceAspNetCoreAuthOptions.MapSubjectClaim(string). This keeps subject mapping in the existing ASP.NET Core adapter instead of adding a parallel mapper.
PathString CallbackPath { get; set; }
Source
Gets or sets the callback path assigned to the OpenID Connect handler.
PathString SignedOutCallbackPath { get; set; }
Source
Gets or sets the signed-out callback path assigned to the OpenID Connect handler.
bool SaveTokens { get; set; }
Source
Gets or sets a value indicating whether tokens should be saved into the authentication ticket.
The default is false. Enabling token storage can increase cookie size and persist sensitive token material in host-owned authentication state.
bool RequireClientSecret { get; set; }
Source
Gets or sets a value indicating whether the OpenID Connect handler must have a client secret configured.
The default is true for confidential ASP.NET Core web applications. Hosts using a provider flow that does not require a client secret can disable this validation explicitly.
AppSurfaceOidcReturnUrlOptions ReturnUrls { get; }
Source
Gets the return-url policy helper used by passive prompt helpers.
Composes OpenID Connect event handlers so AppSurface can attach safe diagnostics without replacing host behavior.
The composer installs a new OpenIdConnectEvents instance on the handler options. Existing handlers are copied or invoked first, then AppSurface adds diagnostics for missing subject claims, remote failures, and optional token persistence.
void Compose(OpenIdConnectOptions options, AppSurfaceOidcAuthOptions appSurfaceOptions)
Source
Rebuilds the OIDC event set with AppSurface diagnostic wrappers.
optionsThe ASP.NET Core OpenID Connect handler options to update.appSurfaceOptionsAppSurface OIDC options that provide subject-claim and token settings.This method overwrites OpenIdConnectOptions.Events. Existing event delegates are preserved by copying pass-through handlers and by invoking host handlers first for OnTokenValidated, OnRemoteFailure, and, when AppSurfaceOidcAuthOptions.SaveTokens is enabled, OnTicketReceived.
Validates OpenID Connect handler options for the AppSurface-owned OIDC scheme.
Validation is scoped to AppSurfaceOidcAuthOptions.OidcScheme so other host-owned OIDC schemes remain untouched. The client-secret requirement follows AppSurfaceOidcAuthOptions.RequireClientSecret.
ValidateOptionsResult Validate(string? name, OpenIdConnectOptions options)
Source
Validates required OIDC handler fields for the matching AppSurface scheme.
nameThe scheme name currently being validated.optionsThe ASP.NET Core OpenID Connect handler options.ValidateOptionsResult.Skip for non-AppSurface schemes, success when authority, client id, and any required client secret are present, or a failure result with stable AppSurface diagnostic messages.
void ThrowIfInvalid(string name, OpenIdConnectOptions options, AppSurfaceOidcAuthOptions appSurfaceOptions)
Source
Fails fast with OptionsValidationException when the AppSurface OIDC handler is invalid.
nameThe scheme name to validate.optionsThe ASP.NET Core OpenID Connect handler options.appSurfaceOptionsAppSurface OIDC registration options that define the validation policy.This helper is intended for post-configuration paths that need the same validation semantics as Validate(string?, OpenIdConnectOptions).
Stable diagnostic codes emitted by the AppSurface OIDC convenience package.
Registers AppSurface-safe ASP.NET Core cookie and OpenID Connect authentication conventions.
IServiceCollection AddAppSurfaceOidcAuth(this IServiceCollection services, Action<AppSurfaceOidcAuthOptions>? configure = null)
Source
Adds named cookie and OpenID Connect authentication schemes with AppSurface-safe defaults.
servicesService collection that receives the registrations.configureOptional AppSurface OIDC convention configuration.The same service collection for chaining.
The method registers named schemes only. It does not set global default schemes, insert middleware, execute challenges, execute redirects, execute sign-in or sign-out, provision users, or configure provider-specific SDKs. Hosts must still call UseAuthentication() and UseAuthorization() in the ASP.NET Core pipeline.
Defines safe diagnostic metadata keys emitted by the AppSurface OIDC convenience package.
These keys identify setup and handler-state diagnostics only. They must not carry raw tokens, raw claims, emails, display names, client secrets, ID-token payloads, or provider response bodies.
Configures return-url validation for AppSurface OIDC passive prompt helpers.
The initial package only allows local app-relative return targets. It does not URL-decode, redirect, challenge, or call an identity provider.
AppSurfaceOidcReturnUrlOptions AllowLocalOnly()
Source
Requires prompt targets to be local app-relative paths.
The current options instance for chaining.
string? Normalize(string? targetPath, string parameterName)
Source
Normalizes an optional passive prompt target path according to the configured return-url policy.
targetPathOptional prompt target path supplied by the host.parameterNameParameter name used when reporting validation failures.null when targetPath is null, empty, or whitespace; otherwise the original target path after validation.
ArgumentExceptionThrown when local-only validation is enabled and targetPath is not a safe app-relative path.bool IsSafeAppRelativePath(string targetPath)
Source
Determines whether a target path is safe for local app-relative prompt metadata.
targetPathTarget path to validate.true when the path starts with a single forward slash, contains no backslashes, and contains no control characters; otherwise false.
Protocol-relative paths such as //example.com, backslash-prefixed paths, and paths containing backslashes are rejected because browsers and proxies can interpret them as cross-origin redirects.