Skip to content

ProfiledJwtIssuer Class

The one door to IJsonWebTokenCreator for what this server signs or encrypts: it refuses to issue a token whose signature or key management algorithm the security profile in force does not admit.

C#
public sealed class ProfiledJwtIssuer

Inheritance System.Object → ProfiledJwtIssuer

Remarks

FAPI 1.0 Part 2 section 8.6: "For JWS, both clients and authorization servers shall use PS256 or ES256 algorithms"; section 8.6.1: "For JWE, both clients and authorization servers shall not use the RSA1_5 algorithm"; FAPI 2.0 section 5.4.1, "when creating or processing JWTs". The algorithm is judged as it is handed to the creator, after every path has chosen it - a client's configuration, a key's declared algorithm, a deployment setting - so no path can reach the creator with one the profile refuses. Each caller's own choice still prefers an admitted algorithm; this is what holds when a choice did not.

Public, though nothing outside this library needs it, because the formatters that take it are public types with public constructors, which the container requires.

Constructors

ProfiledJwtIssuer(IJsonWebTokenCreator, EncryptionAlgorithmsProvider) Constructor

The one door to IJsonWebTokenCreator for what this server signs or encrypts: it refuses to issue a token whose signature or key management algorithm the security profile in force does not admit.

C#
public ProfiledJwtIssuer(Abblix.Jwt.IJsonWebTokenCreator creator, Abblix.Jwt.EncryptionAlgorithmsProvider encryptionAlgorithms);

Parameters

creator IJsonWebTokenCreator

Issues the token once its algorithms are admitted.

encryptionAlgorithms EncryptionAlgorithmsProvider

Tells which keys may be used with a key management algorithm.

Remarks

FAPI 1.0 Part 2 section 8.6: "For JWS, both clients and authorization servers shall use PS256 or ES256 algorithms"; section 8.6.1: "For JWE, both clients and authorization servers shall not use the RSA1_5 algorithm"; FAPI 2.0 section 5.4.1, "when creating or processing JWTs". The algorithm is judged as it is handed to the creator, after every path has chosen it - a client's configuration, a key's declared algorithm, a deployment setting - so no path can reach the creator with one the profile refuses. Each caller's own choice still prefers an admitted algorithm; this is what holds when a choice did not.

Public, though nothing outside this library needs it, because the formatters that take it are public types with public constructors, which the container requires.

Methods

ProfiledJwtIssuer.EncryptClaimsAsync(SecurityProfileRequirements, JsonWebToken, JsonWebKey, string, string) Method

Issues token encrypted to encryptionKey without a signature, as its claims set (EncryptClaimsAsync(JsonWebToken, JsonWebKey, string, string)), once profile admits an unsigned token and the key management algorithm.

C#
public System.Threading.Tasks.Task<string> EncryptClaimsAsync(Abblix.Oidc.Server.Features.ClientInformation.SecurityProfileRequirements profile, Abblix.Jwt.JsonWebToken token, Abblix.Jwt.JsonWebKey encryptionKey, string keyEncryptionAlgorithm, string contentEncryptionAlgorithm);

Parameters

profile SecurityProfileRequirements

The controls in force for what is issued.

token JsonWebToken

The token, its header naming no signature algorithm but none.

encryptionKey JsonWebKey

The key to encrypt to.

keyEncryptionAlgorithm System.String

The key management algorithm.

contentEncryptionAlgorithm System.String

The content encryption algorithm.

Returns

System.Threading.Tasks.Task<System.String>

Exceptions

AlgorithmRefusedByProfileException
The profile admits one of the algorithms not.

ProfiledJwtIssuer.EncryptionAlgorithmFor(SecurityProfileRequirements, JsonWebKey, string) Method

The key management algorithm a token would be encrypted to key under, a key another party publishes, or null when it cannot be: the algorithm the key declares, else defaultAlgorithm, provided this server performs it with a key of this type (CanEncrypt(JsonWebKey, string)), and profile admits it. RFC 8725 section 3.1 binds a key to the algorithm it declares, so a key published for signing, for an algorithm the host did not register, or of a type the default algorithm does not fit is passed over, as is one the profile forbids.

C#
public string? EncryptionAlgorithmFor(Abblix.Oidc.Server.Features.ClientInformation.SecurityProfileRequirements profile, Abblix.Jwt.JsonWebKey key, string defaultAlgorithm);

Parameters

profile SecurityProfileRequirements

The controls in force for what is issued.

key JsonWebKey

The published key.

defaultAlgorithm System.String

The algorithm used for a key that declares none.

Returns

System.String

ProfiledJwtIssuer.IssueAsync(SecurityProfileRequirements, JsonWebToken, JsonWebKey, JsonWebKey, string, string) Method

Issues token, signed with signingKey and, where an encryption key is given, encrypted to it, once profile admits both algorithms.

C#
public System.Threading.Tasks.Task<string> IssueAsync(Abblix.Oidc.Server.Features.ClientInformation.SecurityProfileRequirements profile, Abblix.Jwt.JsonWebToken token, Abblix.Jwt.JsonWebKey? signingKey, Abblix.Jwt.JsonWebKey? encryptionKey=null, string? keyEncryptionAlgorithm=null, string? contentEncryptionAlgorithm=null);

Parameters

profile SecurityProfileRequirements

The controls in force for what is issued.

token JsonWebToken

The token, its header naming the signature algorithm.

signingKey JsonWebKey

The key to sign with.

encryptionKey JsonWebKey

The key to encrypt to, or null to issue a JWS.

keyEncryptionAlgorithm System.String

The key management algorithm, where the token is encrypted.

contentEncryptionAlgorithm System.String

The content encryption algorithm, where the token is encrypted.

Returns

System.Threading.Tasks.Task<System.String>

Exceptions

AlgorithmRefusedByProfileException
The profile admits one of the algorithms not.