AppSurfaceAuthOutcome Outcome { get; }
Source
Gets the high-level auth outcome.
Represents a passive AppSurface auth decision.
AppSurfaceAuthResult describes an auth decision; it does not challenge, forbid, redirect, evaluate policies, sign users in, or sign users out. Host-specific packages map these outcomes to platform behavior.
AppSurfaceAuthResult Allowed(AppSurfaceAuthContext? context = null, string? message = null, IReadOnlyDictionary<string, string>? metadata = null)
Source
Creates a result that allows the requested operation.
contextOptional auth context that was evaluated.messageOptional message supplied by the host adapter for its own display contract.metadataOptional metadata copied with ordinal keys.An allowed auth result.
AppSurfaceAuthResult Challenge(AppSurfaceAuthContext? context = null, string? message = null, IReadOnlyDictionary<string, string>? metadata = null)
Source
Creates a result indicating that the caller should authenticate before retrying.
contextOptional auth context that was evaluated.messageOptional message supplied by the host adapter for its own display contract.metadataOptional metadata copied with ordinal keys.A challenge auth result.
AppSurfaceAuthResult Unauthenticated(AppSurfaceAuthContext? context = null, string? message = null, IReadOnlyDictionary<string, string>? metadata = null)
Source
Creates a result indicating that the caller is not authenticated.
contextOptional auth context that was evaluated.messageOptional message supplied by the host adapter for its own display contract.metadataOptional metadata copied with ordinal keys.A challenge auth result.
AppSurfaceAuthResult Forbid(AppSurfaceAuthContext? context = null, string? message = null, IReadOnlyDictionary<string, string>? metadata = null)
Source
Creates a result indicating that the authenticated caller is forbidden.
contextOptional auth context that was evaluated.messageOptional message supplied by the host adapter for its own display contract.metadataOptional metadata copied with ordinal keys.A forbidden auth result.
AppSurfaceAuthResult Forbidden(AppSurfaceAuthContext? context = null, string? message = null, IReadOnlyDictionary<string, string>? metadata = null)
Source
Creates a result indicating that the authenticated caller is forbidden.
contextOptional auth context that was evaluated.messageOptional message supplied by the host adapter for its own display contract.metadataOptional metadata copied with ordinal keys.A forbidden auth result.
AppSurfaceAuthResult MissingPolicy(AppSurfaceAuthContext? context = null, string? message = null, IReadOnlyDictionary<string, string>? metadata = null)
Source
Creates a setup-failure result for a missing host-owned policy.
contextOptional auth context that was evaluated.messageOptional message supplied by the host adapter for its own display contract.metadataOptional metadata copied with ordinal keys.A setup-failure auth result.
AppSurfaceAuthResult MissingServices(AppSurfaceAuthContext? context = null, string? message = null, IReadOnlyDictionary<string, string>? metadata = null)
Source
Creates a setup-failure result for missing host-owned auth services.
contextOptional auth context that was evaluated.messageOptional message supplied by the host adapter for its own display contract.metadataOptional metadata copied with ordinal keys.A setup-failure auth result.
AppSurfaceAuthResult MissingSubject(AppSurfaceAuthContext? context = null, string? message = null, IReadOnlyDictionary<string, string>? metadata = null)
Source
Creates a setup-failure result for an authenticated caller that could not be mapped to a stable subject.
contextOptional auth context that was evaluated.messageOptional message supplied by the host adapter for its own display contract.metadataOptional metadata copied with ordinal keys.A setup-failure auth result.
AppSurfaceAuthResult UnsafeReturnUrl(AppSurfaceAuthContext? context = null, string? message = null, IReadOnlyDictionary<string, string>? metadata = null)
Source
Creates a result for an unsafe return or navigation target.
contextOptional auth context that was evaluated.messageOptional message supplied by the host adapter for its own display contract.metadataOptional metadata copied with ordinal keys.An unsafe-navigation auth result.
AppSurfaceAuthResult StaleOrUnknownSession(AppSurfaceAuthContext? context = null, string? message = null, IReadOnlyDictionary<string, string>? metadata = null)
Source
Creates a result for stale, expired, missing, or unresolved session state.
contextOptional auth context that was evaluated.messageOptional message supplied by the host adapter for its own display contract.metadataOptional metadata copied with ordinal keys.A stale-or-unknown-session auth result.
AppSurfaceAuthOutcome Outcome { get; }
Source
Gets the high-level auth outcome.
AppSurfaceAuthReason Reason { get; }
Source
Gets the concrete reason associated with Outcome.
AppSurfaceAuthContext? Context { get; }
Source
Gets the optional auth context that was evaluated.
string? Message { get; }
Source
Gets an optional message supplied by the host adapter for that adapter's own display contract.
IReadOnlyDictionary<string, string> Metadata { get; }
Source
Gets copied metadata that can help adapters preserve host-specific context.
bool IsAllowed { get; }
Source
Gets a value indicating whether the outcome allows the requested operation.
bool RequiresAuthentication { get; }
Source
Gets a value indicating whether the caller should authenticate before retrying.
bool IsConfigurationFailure { get; }
Source
Gets a value indicating whether the outcome represents host setup or configuration failure.
Defines the high-level auth outcome AppSurface modules can understand without owning host authentication.
Defines the concrete reason associated with an AppSurface auth outcome.
Carries display-safe context for resolving an external subject to an app-owned user id.
The context is an input to an app-owned resolver. It may carry safe correlation, issuer, tenant, or provisioning policy hints, but those hints are not authority unless the application validates them against its own security and persistence rules. Metadata is copied with ordinal keys.
AppSurfaceUserIdentityResolutionContext Empty { get; }
Source
Gets an empty resolution context.
string? CorrelationId { get; }
Source
Gets the optional display-safe correlation id.
IReadOnlyDictionary<string, string> Metadata { get; }
Source
Gets copied metadata that can help an app resolver preserve display-safe context.
Defines reserved metadata keys used by AppSurface auth contracts.
Metadata is context for diagnostics, display, and adapter hand-off. It is not an authorization source of truth unless a host-owned adapter validates the value against the host security system. The appsurface. prefix is reserved for AppSurface-owned keys so future typed properties can migrate existing metadata without key collisions.
Describes an authenticated external subject before it has been resolved to an app-owned user id.
The uniqueness key is the ordinal tuple of Issuer, Subject, and optional PartitionKey. Use PartitionKey only for host-validated realm, tenant, client, or environment context that is part of the subject namespace. AppSurface does not treat the partition as tenant authority or authorization truth. The raw values are intentionally omitted from ToString.
string Issuer { get; }
Source
Gets the stable issuer or identity-provider namespace.
string Subject { get; }
Source
Gets the stable subject id inside the issuer namespace.
string? PartitionKey { get; }
Source
Gets the optional host-validated partition that participates in the uniqueness key.
Represents surface-neutral session information associated with an AppSurface auth context.
Session timestamps use DateTimeOffset so host adapters can preserve their original offset. AppSurface does not convert, refresh, revoke, store, or validate the backing host session.
string Id { get; }
Source
Gets the stable host-owned session identifier.
DateTimeOffset? StartedAt { get; }
Source
Gets the optional timestamp when the host session began.
DateTimeOffset? ExpiresAt { get; }
Source
Gets the optional timestamp when the host session expires.
IReadOnlyDictionary<string, string> Metadata { get; }
Source
Gets copied metadata that can help adapters or diagnostics preserve host-specific context.
Registers the surface-neutral AppSurface auth composition boundary.
AppSurfaceAuthModule is a boundary-preview module. It gives AppSurface packages a stable place to compose future auth contracts without taking a dependency on ASP.NET Core authentication, authorization policies, identity providers, middleware, endpoint filters, cookies, bearer tokens, or UI. Registering this module does not sign users in, inspect requests, challenge callers, forbid callers, or enforce authorization; host applications must continue to configure those behaviors in their host-specific security stack.
void ConfigureServices(StartupContext context, IServiceCollection services)
Source
Registers the AppSurface auth boundary options type.
contextStartup context for the current AppSurface composition pass.servicesService collection that receives the boundary-preview options registration.This method registers AppSurfaceAuthOptions with the Microsoft Options pattern so later AppSurface auth contracts have a documented options home. It intentionally adds no runtime auth behavior and performs no request, principal, policy, middleware, or identity-provider configuration.
void RegisterDependentModules(ModuleDependencyBuilder builder)
Source
Registers modules required by the AppSurface auth boundary.
builderThe module dependency builder for the current startup graph.The boundary preview has no dependent modules. Future host-specific auth integrations should declare their own dependencies instead of relying on this module to pull in ASP.NET Core or UI packages.
Represents the result of resolving an external subject to a durable app-owned user id.
This result family is intentionally separate from AppSurfaceAuthResult. Authentication, policy, and navigation outcomes remain host-auth decisions; identity resolution describes the app-owned mapping step that can happen after the host has authenticated a subject. Messages and metadata should be display-safe and avoid raw subjects, emails, tokens, and provider payloads by default.
AppSurfaceUserIdentityResult Resolved(AppUserId appUserId, ExternalSubject subject, string? message = null, IReadOnlyDictionary<string, string>? metadata = null)
Source
Creates a successful identity resolution result.
appUserIdThe durable app-owned user id.subjectThe external subject tuple that resolved to the app user.messageOptional display-safe message supplied by the app resolver.metadataOptional display or diagnostic metadata copied with ordinal keys.A resolved identity result.
AppSurfaceUserIdentityResult MissingSubject(string? message = null, IReadOnlyDictionary<string, string>? metadata = null)
Source
Creates a failure result for a missing external subject.
messageOptional display-safe message supplied by the app resolver.metadataOptional display or diagnostic metadata copied with ordinal keys.A missing-subject identity result.
AppSurfaceUserIdentityResult MalformedSubject(string? message = null, IReadOnlyDictionary<string, string>? metadata = null)
Source
Creates a failure result for a malformed external subject.
messageOptional display-safe message supplied by the app resolver.metadataOptional display or diagnostic metadata copied with ordinal keys.A malformed-subject identity result.
AppSurfaceUserIdentityResult DisabledAppUser(ExternalSubject? subject = null, string? message = null, IReadOnlyDictionary<string, string>? metadata = null)
Source
Creates a failure result for a disabled app user.
subjectOptional external subject involved in the failed resolution.messageOptional display-safe message supplied by the app resolver.metadataOptional display or diagnostic metadata copied with ordinal keys.A disabled-app-user identity result.
AppSurfaceUserIdentityResult StaleOrUnknownSession(ExternalSubject? subject = null, string? message = null, IReadOnlyDictionary<string, string>? metadata = null)
Source
Creates a failure result for a stale or unknown session.
subjectOptional external subject involved in the failed resolution.messageOptional display-safe message supplied by the app resolver.metadataOptional display or diagnostic metadata copied with ordinal keys.A stale-or-unknown-session identity result.
AppSurfaceUserIdentityResult DuplicateMapping(ExternalSubject? subject = null, string? message = null, IReadOnlyDictionary<string, string>? metadata = null)
Source
Creates a failure result for duplicate mappings.
subjectOptional external subject involved in the failed resolution.messageOptional display-safe message supplied by the app resolver.metadataOptional display or diagnostic metadata copied with ordinal keys.A duplicate-mapping identity result.
AppSurfaceUserIdentityResult ProvisioningDenied(ExternalSubject? subject = null, string? message = null, IReadOnlyDictionary<string, string>? metadata = null)
Source
Creates a failure result when the app declines provisioning or attachment.
subjectOptional external subject involved in the failed resolution.messageOptional display-safe message supplied by the app resolver.metadataOptional display or diagnostic metadata copied with ordinal keys.A provisioning-denied identity result.
AppSurfaceUserIdentityStatus Status { get; }
Source
Gets the identity resolution status.
AppUserId? AppUserId { get; }
Source
Gets the resolved app-owned user id when Succeeded is true.
ExternalSubject? Subject { get; }
Source
Gets the external subject tuple involved in resolution when it was available and valid enough to report safely.
string? Message { get; }
Source
Gets an optional display-safe message supplied by the app resolver.
IReadOnlyDictionary<string, string> Metadata { get; }
Source
Gets copied metadata that can help adapters or diagnostics preserve app-specific context.
bool Succeeded { get; }
Source
Gets a value indicating whether the external subject resolved to an app-owned user id.
Defines result states for resolving an external subject to an app-owned user id.
Represents the surface-neutral identity information AppSurface modules can share about a user.
AppSurfaceUser is not a claims principal, identity-provider user, or authorization policy result. Host adapters should map their security system into this passive value only after authenticating the subject. Metadata is copied with ordinal keys and should be treated as context, not as authority for authorization decisions.
string Id { get; }
Source
Gets the stable host-owned user identifier.
string? DisplayName { get; }
Source
Gets the optional display name for UI or diagnostics.
string? Email { get; }
Source
Gets the optional email address for UI or diagnostics.
IReadOnlyDictionary<string, string> Metadata { get; }
Source
Gets copied metadata that can help adapters or diagnostics preserve host-specific context.
Describes a passive AppSurface auth audit event.
This value does not write logs, traces, metrics, or persistent audit records. Host applications own audit transport, retention, redaction, and access control. Metadata should remain non-sensitive and diagnostic.
string Name { get; }
Source
Gets the stable event name.
DateTimeOffset Timestamp { get; }
Source
Gets the timestamp supplied by the host.
AppSurfaceAuthOutcome Outcome { get; }
Source
Gets the high-level auth outcome associated with the event.
AppSurfaceAuthReason Reason { get; }
Source
Gets the concrete auth reason associated with the event.
string? UserId { get; }
Source
Gets the optional user identifier associated with the event.
string? SessionId { get; }
Source
Gets the optional session identifier associated with the event.
IReadOnlyDictionary<string, string> Metadata { get; }
Source
Gets copied metadata that can help adapters or diagnostics preserve host-specific context.
Describes a possible host-owned login prompt without executing sign-in or redirects.
The prompt is passive. It never writes cookies, challenges a caller, redirects a response, or invokes an identity provider. Host UI or host adapters decide whether and how to act on it.
string? TargetPath { get; }
Source
Gets the optional app-relative target for host-owned login UI.
string? DisplayText { get; }
Source
Gets optional display text for host-owned login UI.
IReadOnlyDictionary<string, string> Metadata { get; }
Source
Gets copied metadata that can help adapters or diagnostics preserve host-specific context.
Describes a possible host-owned logout prompt without executing sign-out or redirects.
The prompt is passive. It never clears cookies, signs out a caller, redirects a response, or invokes an identity provider. Host UI or host adapters decide whether and how to act on it.
string? TargetPath { get; }
Source
Gets the optional app-relative target for host-owned logout UI.
string? DisplayText { get; }
Source
Gets optional display text for host-owned logout UI.
IReadOnlyDictionary<string, string> Metadata { get; }
Source
Gets copied metadata that can help adapters or diagnostics preserve host-specific context.
Options root for the surface-neutral AppSurface auth composition boundary.
This boundary-preview type is intentionally empty. It exists so future AppSurface auth contracts can add settings through a stable options root after those contracts are proven. It does not configure authentication schemes, authorization policies, user or session access, tenant behavior, identity providers, cookies, bearer tokens, challenges, forbids, middleware, endpoint filters, or UI. Host applications must keep those choices in their host-specific security configuration until a later AppSurface package explicitly owns them.
Captures the passive user and session context available to AppSurface auth-aware modules.
A context with no User is a valid anonymous context. The context does not evaluate policies, read the current request, or wrap ASP.NET Core ClaimsPrincipal; host-specific adapters own those mappings.
AppSurfaceAuthContext Anonymous { get; }
Source
Gets an anonymous auth context with no user, no session, and no metadata.
AppSurfaceUser? User { get; }
Source
Gets the optional authenticated user description.
AppSurfaceSession? Session { get; }
Source
Gets the optional session description.
IReadOnlyDictionary<string, string> Metadata { get; }
Source
Gets copied metadata that can help adapters or diagnostics preserve host-specific context.
bool IsAuthenticated { get; }
Source
Gets a value indicating whether the context contains a user description.
Resolves authenticated external subjects to durable app-owned user ids.
ExternalSubject tuple, honor cancellation before starting expensive work and while awaiting I/O, and handle concurrent first-time resolution without creating duplicate app users. Prefer enforcing uniqueness at the mapping store with a unique constraint over the external subject tuple (issuer, subject, and partition key), then make competing inserts converge on the same app user id through optimistic concurrency or a transaction retry. Stores that cannot enforce uniqueness should use an equivalent first-provisioning guard, such as a short distributed lock scoped to the external subject tuple.
Avoid a check-then-insert flow that reads a missing mapping and blindly creates a new app user. Concurrent sign-ins can otherwise provision duplicate app users before either caller observes the other mapping.
ValueTask<AppSurfaceUserIdentityResult> ResolveAsync(ExternalSubject subject, AppSurfaceUserIdentityResolutionContext context, CancellationToken cancellationToken = default)
Source
Resolves an external subject to a durable app-owned user id.
subjectThe authenticated external subject to resolve.contextDisplay-safe resolution context supplied by the host integration.cancellationTokenCancellation token for resolver work and awaited I/O.An identity resolution result with either an app-owned user id or a typed failure state.
Identifies a durable app-owned user record after an external authenticated subject has been resolved.
AppUserId belongs to the consuming application. AppSurface does not allocate ids, prescribe storage, or treat the id as a permission source. The value is intentionally omitted from ToString so accidental logs and diagnostics do not disclose user identifiers by default.
string Value { get; }
Source
Gets the stable app-owned user id value.