Skip to main content

AuthSessionExtensions Class

Abblix.Oidc.Server

Abblix.Oidc.Server.Features.UserAuthentication

AuthSessionExtensions Class

Provides extension methods for AuthSession, facilitating the conversion between authentication session information and JWT claims.

public static class AuthSessionExtensions

Inheritance System.Object → AuthSessionExtensions

Methods

AuthSessionExtensions.ApplyTo(this AuthSession, JsonWebTokenPayload) Method

Applies the values from an AuthSession object to a JsonWebTokenPayload, effectively transferring the authentication session information into JWT claims.

public static void ApplyTo(this Abblix.Oidc.Server.Features.UserAuthentication.AuthSession authSession, Abblix.Jwt.JsonWebTokenPayload payload);

Parameters

authSession AuthSession

The authentication session containing the user's authentication information.

payload JsonWebTokenPayload

The JWT payload where the authentication session information will be applied as claims.

Remarks

This method transfers authentication session details into the JWT payload, including: - Subject, SessionId, AuthenticationTime, IdentityProvider, AuthContextClassRef, AuthenticationMethodReferences - Email and EmailVerified (when specified in the session) - Any additional custom claims from AdditionalClaims

AuthSessionExtensions.ToAuthSession(this JsonWebTokenPayload) Method

Creates an AuthSession object from a collection of JWT claims present in a JsonWebTokenPayload.

public static Abblix.Oidc.Server.Features.UserAuthentication.AuthSession ToAuthSession(this Abblix.Jwt.JsonWebTokenPayload payload);

Parameters

payload JsonWebTokenPayload

The JWT payload containing claims that represent an authentication session.

Returns

AuthSession
An instance of AuthSession populated with information derived from the JWT claims.

Remarks

This method allows for the reconstruction of an authentication session from the claims encoded in a JWT. It is particularly useful when processing JWTs to extract authentication and user session details.