Skip to main content

ClientJwtFormatter Class

Abblix.Oidc.Server

Abblix.Oidc.Server.Features.Tokens.Formatters

ClientJwtFormatter Class

Provides functionality to format JSON Web Tokens (JWTs) issued to clients by the authentication service. This class handles the signing of JWTs and, if configured, their encryption, based on the needs of each client.

public class ClientJwtFormatter : Abblix.Oidc.Server.Features.Tokens.Formatters.IClientJwtFormatter

Inheritance System.Object → ClientJwtFormatter

Implements IClientJwtFormatter

Constructors

ClientJwtFormatter(IJsonWebTokenCreator, IClientKeysProvider, IAuthServiceKeysProvider, IOptions<OidcOptions>) Constructor

Provides functionality to format JSON Web Tokens (JWTs) issued to clients by the authentication service. This class handles the signing of JWTs and, if configured, their encryption, based on the needs of each client.

public ClientJwtFormatter(Abblix.Jwt.IJsonWebTokenCreator jwtCreator, Abblix.Oidc.Server.Features.ClientInformation.IClientKeysProvider clientKeysProvider, Abblix.Oidc.Server.Common.Interfaces.IAuthServiceKeysProvider serviceKeysProvider, Microsoft.Extensions.Options.IOptions<Abblix.Oidc.Server.Common.Configuration.OidcOptions> options);

Parameters

jwtCreator IJsonWebTokenCreator

Creator for issuing JWTs.

clientKeysProvider IClientKeysProvider

Provider for client encryption keys.

serviceKeysProvider IAuthServiceKeysProvider

Provider for service signing keys.

options Microsoft.Extensions.Options.IOptions<OidcOptions>

OIDC configuration options.

Methods

ClientJwtFormatter.FormatAsync(JsonWebToken, ClientInfo) Method

Asynchronously formats a JWT for a specific client, inferring the encryption metadata from the token's header typ (id_token/logout_token vs. UserInfo).

public System.Threading.Tasks.Task<string> FormatAsync(Abblix.Jwt.JsonWebToken token, Abblix.Oidc.Server.Features.ClientInformation.ClientInfo clientInfo);

Parameters

token JsonWebToken

The JSON Web Token (JWT) to be formatted for the client.

clientInfo ClientInfo

Information about the client to which the JWT is issued, including any requirements for encryption.

Implements FormatAsync(JsonWebToken, ClientInfo)

Returns

System.Threading.Tasks.Task<System.String>
A task that returns a JWT string formatted and ready for use by the client.

ClientJwtFormatter.FormatAsync(JsonWebToken, ClientInfo, ClientJwtEncryption) Method

Asynchronously formats a JWT for a specific client, signing it with the authentication service's key chosen by the token's header algorithm and — per the supplied encryption policy — optionally encrypting it to the client's registered public key.

public System.Threading.Tasks.Task<string> FormatAsync(Abblix.Jwt.JsonWebToken token, Abblix.Oidc.Server.Features.ClientInformation.ClientInfo clientInfo, Abblix.Oidc.Server.Features.Tokens.Formatters.ClientJwtEncryption encryption);

Parameters

token JsonWebToken

The JSON Web Token (JWT) to be formatted for the client.

clientInfo ClientInfo

Information about the client to which the JWT is issued.

encryption ClientJwtEncryption

The encryption policy: which registered client metadata governs encryption, the content-encryption default, and whether encryption requires a registered key-management algorithm.

Implements FormatAsync(JsonWebToken, ClientInfo, ClientJwtEncryption)

Returns

System.Threading.Tasks.Task<System.String>
A task that returns a JWT string formatted and ready for use by the client.