AuthenticationSchemeAdapter Class
Adapts ASP.NET Authentication Scheme to the IAuthSessionService interface. This adapter allows the integration of the Abblix OIDC Server with standard ASP.NET authentication mechanisms, enabling the use of existing authentication schemes to manage OIDC sessions.
public class AuthenticationSchemeAdapter : Abblix.Oidc.Server.Features.UserAuthentication.IAuthSessionServiceInheritance System.Object → AuthenticationSchemeAdapter
Implements IAuthSessionService
Constructors
AuthenticationSchemeAdapter(IHttpContextAccessor, string) Constructor
Adapts ASP.NET Authentication Scheme to the IAuthSessionService interface. This adapter allows the integration of the Abblix OIDC Server with standard ASP.NET authentication mechanisms, enabling the use of existing authentication schemes to manage OIDC sessions.
public AuthenticationSchemeAdapter(Microsoft.AspNetCore.Http.IHttpContextAccessor httpContextAccessor, string authenticationScheme="Cookies");Parameters
httpContextAccessor Microsoft.AspNetCore.Http.IHttpContextAccessor
Provides access to the Abblix.Oidc.Server.AspNetCore.AuthenticationSchemeAdapter.HttpContext, allowing operations on the HTTP context of the current request.
authenticationScheme System.String
The authentication scheme to use for all authentication operations. This scheme will be explicitly specified when calling SignInAsync, SignOutAsync, and AuthenticateAsync methods.
Methods
AuthenticationSchemeAdapter.AuthenticateAsync() Method
Attempts to authenticate the current user based on the configured default authentication scheme, converting the authentication results into an AuthSession.
public System.Threading.Tasks.Task<Abblix.Oidc.Server.Features.UserAuthentication.AuthSession?> AuthenticateAsync();Implements AuthenticateAsync()
Returns
System.Threading.Tasks.Task<AuthSession>
A task that returns the AuthSession
of the authenticated user or null if the authentication fails.
Remarks
A cookie that authenticates under the configured scheme but does not carry the OIDC session claims this adapter writes (for example a plain application login cookie sharing the same scheme name, or a cookie whose claims are malformed) is treated as "no OIDC session" - the method returns null rather than throwing, so an unrelated cookie never turns a request into a 500.
AuthenticationSchemeAdapter.GetAvailableAuthSessions() Method
Asynchronously retrieves the current user's authentication session if available. This method wraps ASP.NET's built-in authentication mechanisms to provide an AuthSession model.
public System.Collections.Generic.IAsyncEnumerable<Abblix.Oidc.Server.Features.UserAuthentication.AuthSession> GetAvailableAuthSessions();Implements GetAvailableAuthSessions()
Returns
System.Collections.Generic.IAsyncEnumerable<AuthSession>
An asynchronous stream of AuthSession instances representing the user's current
authentication sessions.
Remarks
The cookie-backed authentication scheme carries a single signed-in identity, so this stream yields at most one session - the one represented by the current request's cookie. Multiple concurrent user accounts per browser session are not modelled by this adapter.
AuthenticationSchemeAdapter.SignInAsync(AuthSession) Method
Signs in the specified user into the application, setting up their authentication session. Critical claims (Subject, SessionId, AuthenticationTime, AuthenticationMethodReferences) are stored in principal claims. AffectedClientIds stored in properties as it's not needed in cookie events.
public System.Threading.Tasks.Task SignInAsync(Abblix.Oidc.Server.Features.UserAuthentication.AuthSession authSession);Parameters
authSession AuthSession
The authentication session details to be used for signing in.
Implements SignInAsync(AuthSession)
Returns
System.Threading.Tasks.Task
A task that represents the asynchronous sign-in operation.
AuthenticationSchemeAdapter.SignOutAsync() Method
Signs out the current user from the application, ending their authenticated session.
public System.Threading.Tasks.Task SignOutAsync();Implements SignOutAsync()
Returns
System.Threading.Tasks.Task
A task that represents the asynchronous sign-out operation.