#### [Abblix\.Oidc\.Server](https://www.abblix.com/en/docs/api/abblix-oidc-server 'index')
### [Abblix\.Oidc\.Server\.Endpoints\.Token\.Grants](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Endpoints.Token.Grants 'Abblix\.Oidc\.Server\.Endpoints\.Token\.Grants')

## JwtBearerGrantHandler Class

Handles the JWT Bearer grant type per RFC 7523, allowing clients to exchange a JWT assertion
for an access token\. This grant type is used when a client has obtained a JWT from a trusted
identity provider and wants to exchange it for an access token at this authorization server\.

```csharp
public class JwtBearerGrantHandler : Abblix.Oidc.Server.Endpoints.Token.Grants.IAuthorizationGrantHandler, Abblix.Oidc.Server.Common.Interfaces.IGrantTypeInformer
```

Inheritance [System\.Object](https://learn.microsoft.com/en-us/dotnet/api/system.object 'System\.Object') → JwtBearerGrantHandler

Implements [IAuthorizationGrantHandler](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Endpoints.Token.Grants.IAuthorizationGrantHandler 'Abblix\.Oidc\.Server\.Endpoints\.Token\.Grants\.IAuthorizationGrantHandler'), [IGrantTypeInformer](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Common.Interfaces.IGrantTypeInformer 'Abblix\.Oidc\.Server\.Common\.Interfaces\.IGrantTypeInformer')

### Remarks
The JWT Bearer grant type is specified in RFC 7523 and is commonly used in scenarios such as:
\- Service\-to\-service authentication with pre\-existing trust relationships
\- Token exchange between federated identity providers
\- API\-to\-API communication where the calling service has a JWT from an identity provider
\- Single sign\-on \(SSO\) across different domains or organizations

The JWT assertion must contain specific claims per RFC 7523 Section 3:
\- iss \(issuer\): Identifies the principal that issued the JWT
\- sub \(subject\): Identifies the principal that is the subject of the JWT
\- aud \(audience\): Identifies the recipients that the JWT is intended for \(must include this authorization server\)
\- exp \(expiration time\): Identifies the expiration time on or after which the JWT MUST NOT be accepted
\- jti \(JWT ID\): Optional but recommended for replay protection per RFC 7523 Section 5\.2

The authorization server validates the JWT signature, claims, and ensures the issuer is trusted
before issuing an access token\.
### Constructors

## JwtBearerGrantHandler\(ILogger\<JwtBearerGrantHandler\>, IJsonWebTokenValidator, IJwtBearerIssuerProvider, IRequestInfoProvider, ISessionIdGenerator, TimeProvider\) Constructor {#Abblix.Oidc.Server.Endpoints.Token.Grants.JwtBearerGrantHandler.JwtBearerGrantHandler(Microsoft.Extensions.Logging.ILogger_Abblix.Oidc.Server.Endpoints.Token.Grants.JwtBearerGrantHandler_,Abblix.Jwt.IJsonWebTokenValidator,Abblix.Oidc.Server.Features.JwtBearer.IJwtBearerIssuerProvider,Abblix.Oidc.Server.Common.Interfaces.IRequestInfoProvider,Abblix.Oidc.Server.Features.RandomGenerators.ISessionIdGenerator,System.TimeProvider)}

Handles the JWT Bearer grant type per RFC 7523, allowing clients to exchange a JWT assertion
for an access token\. This grant type is used when a client has obtained a JWT from a trusted
identity provider and wants to exchange it for an access token at this authorization server\.

```csharp
public JwtBearerGrantHandler(Microsoft.Extensions.Logging.ILogger<Abblix.Oidc.Server.Endpoints.Token.Grants.JwtBearerGrantHandler> logger, Abblix.Jwt.IJsonWebTokenValidator jwtValidator, Abblix.Oidc.Server.Features.JwtBearer.IJwtBearerIssuerProvider issuerProvider, Abblix.Oidc.Server.Common.Interfaces.IRequestInfoProvider requestInfoProvider, Abblix.Oidc.Server.Features.RandomGenerators.ISessionIdGenerator sessionIdGenerator, System.TimeProvider timeProvider);
```
#### Parameters

###### `logger` [Microsoft\.Extensions\.Logging\.ILogger&lt;](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.ilogger-1 'Microsoft\.Extensions\.Logging\.ILogger\`1')[JwtBearerGrantHandler](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Endpoints.Token.Grants.JwtBearerGrantHandler 'Abblix\.Oidc\.Server\.Endpoints\.Token\.Grants\.JwtBearerGrantHandler')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.ilogger-1 'Microsoft\.Extensions\.Logging\.ILogger\`1') {#Abblix.Oidc.Server.Endpoints.Token.Grants.JwtBearerGrantHandler.JwtBearerGrantHandler(Microsoft.Extensions.Logging.ILogger_Abblix.Oidc.Server.Endpoints.Token.Grants.JwtBearerGrantHandler_,Abblix.Jwt.IJsonWebTokenValidator,Abblix.Oidc.Server.Features.JwtBearer.IJwtBearerIssuerProvider,Abblix.Oidc.Server.Common.Interfaces.IRequestInfoProvider,Abblix.Oidc.Server.Features.RandomGenerators.ISessionIdGenerator,System.TimeProvider).logger}

Logger for recording JWT Bearer grant validation events and errors\.

###### `jwtValidator` [IJsonWebTokenValidator](https://www.abblix.com/en/docs/api/abblix-jwt/Abblix.Jwt.IJsonWebTokenValidator 'Abblix\.Jwt\.IJsonWebTokenValidator') {#Abblix.Oidc.Server.Endpoints.Token.Grants.JwtBearerGrantHandler.JwtBearerGrantHandler(Microsoft.Extensions.Logging.ILogger_Abblix.Oidc.Server.Endpoints.Token.Grants.JwtBearerGrantHandler_,Abblix.Jwt.IJsonWebTokenValidator,Abblix.Oidc.Server.Features.JwtBearer.IJwtBearerIssuerProvider,Abblix.Oidc.Server.Common.Interfaces.IRequestInfoProvider,Abblix.Oidc.Server.Features.RandomGenerators.ISessionIdGenerator,System.TimeProvider).jwtValidator}

Validates JWT assertions including signature verification and claims validation\.

###### `issuerProvider` [IJwtBearerIssuerProvider](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.JwtBearer.IJwtBearerIssuerProvider 'Abblix\.Oidc\.Server\.Features\.JwtBearer\.IJwtBearerIssuerProvider') {#Abblix.Oidc.Server.Endpoints.Token.Grants.JwtBearerGrantHandler.JwtBearerGrantHandler(Microsoft.Extensions.Logging.ILogger_Abblix.Oidc.Server.Endpoints.Token.Grants.JwtBearerGrantHandler_,Abblix.Jwt.IJsonWebTokenValidator,Abblix.Oidc.Server.Features.JwtBearer.IJwtBearerIssuerProvider,Abblix.Oidc.Server.Common.Interfaces.IRequestInfoProvider,Abblix.Oidc.Server.Features.RandomGenerators.ISessionIdGenerator,System.TimeProvider).issuerProvider}

Provides comprehensive JWT Bearer functionality including trusted issuers, keys, and replay protection\.

###### `requestInfoProvider` [IRequestInfoProvider](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Common.Interfaces.IRequestInfoProvider 'Abblix\.Oidc\.Server\.Common\.Interfaces\.IRequestInfoProvider') {#Abblix.Oidc.Server.Endpoints.Token.Grants.JwtBearerGrantHandler.JwtBearerGrantHandler(Microsoft.Extensions.Logging.ILogger_Abblix.Oidc.Server.Endpoints.Token.Grants.JwtBearerGrantHandler_,Abblix.Jwt.IJsonWebTokenValidator,Abblix.Oidc.Server.Features.JwtBearer.IJwtBearerIssuerProvider,Abblix.Oidc.Server.Common.Interfaces.IRequestInfoProvider,Abblix.Oidc.Server.Features.RandomGenerators.ISessionIdGenerator,System.TimeProvider).requestInfoProvider}

Provides information about the current HTTP request for audience validation\.

###### `sessionIdGenerator` [ISessionIdGenerator](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.RandomGenerators.ISessionIdGenerator 'Abblix\.Oidc\.Server\.Features\.RandomGenerators\.ISessionIdGenerator') {#Abblix.Oidc.Server.Endpoints.Token.Grants.JwtBearerGrantHandler.JwtBearerGrantHandler(Microsoft.Extensions.Logging.ILogger_Abblix.Oidc.Server.Endpoints.Token.Grants.JwtBearerGrantHandler_,Abblix.Jwt.IJsonWebTokenValidator,Abblix.Oidc.Server.Features.JwtBearer.IJwtBearerIssuerProvider,Abblix.Oidc.Server.Common.Interfaces.IRequestInfoProvider,Abblix.Oidc.Server.Features.RandomGenerators.ISessionIdGenerator,System.TimeProvider).sessionIdGenerator}

Generates unique session identifiers for authentication sessions\.

###### `timeProvider` [System\.TimeProvider](https://learn.microsoft.com/en-us/dotnet/api/system.timeprovider 'System\.TimeProvider') {#Abblix.Oidc.Server.Endpoints.Token.Grants.JwtBearerGrantHandler.JwtBearerGrantHandler(Microsoft.Extensions.Logging.ILogger_Abblix.Oidc.Server.Endpoints.Token.Grants.JwtBearerGrantHandler_,Abblix.Jwt.IJsonWebTokenValidator,Abblix.Oidc.Server.Features.JwtBearer.IJwtBearerIssuerProvider,Abblix.Oidc.Server.Common.Interfaces.IRequestInfoProvider,Abblix.Oidc.Server.Features.RandomGenerators.ISessionIdGenerator,System.TimeProvider).timeProvider}

Provides access to the current time for session timestamps\.

### Remarks
The JWT Bearer grant type is specified in RFC 7523 and is commonly used in scenarios such as:
\- Service\-to\-service authentication with pre\-existing trust relationships
\- Token exchange between federated identity providers
\- API\-to\-API communication where the calling service has a JWT from an identity provider
\- Single sign\-on \(SSO\) across different domains or organizations

The JWT assertion must contain specific claims per RFC 7523 Section 3:
\- iss \(issuer\): Identifies the principal that issued the JWT
\- sub \(subject\): Identifies the principal that is the subject of the JWT
\- aud \(audience\): Identifies the recipients that the JWT is intended for \(must include this authorization server\)
\- exp \(expiration time\): Identifies the expiration time on or after which the JWT MUST NOT be accepted
\- jti \(JWT ID\): Optional but recommended for replay protection per RFC 7523 Section 5\.2

The authorization server validates the JWT signature, claims, and ensures the issuer is trusted
before issuing an access token\.
### Properties

## JwtBearerGrantHandler\.GrantTypesSupported Property {#Abblix.Oidc.Server.Endpoints.Token.Grants.JwtBearerGrantHandler.GrantTypesSupported}

Specifies the grant type that this handler supports, which is the JWT Bearer grant type\.

```csharp
public System.Collections.Generic.IEnumerable<string> GrantTypesSupported { get; }
```

Implements [GrantTypesSupported](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Common.Interfaces.IGrantTypeInformer#Abblix.Oidc.Server.Common.Interfaces.IGrantTypeInformer.GrantTypesSupported 'Abblix\.Oidc\.Server\.Common\.Interfaces\.IGrantTypeInformer\.GrantTypesSupported')

#### Property Value
[System\.Collections\.Generic\.IEnumerable&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerable-1 'System\.Collections\.Generic\.IEnumerable\`1')[System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerable-1 'System\.Collections\.Generic\.IEnumerable\`1')
### Methods

## JwtBearerGrantHandler\.AuthorizeAsync\(TokenRequest, ClientInfo\) Method {#Abblix.Oidc.Server.Endpoints.Token.Grants.JwtBearerGrantHandler.AuthorizeAsync(Abblix.Oidc.Server.Model.TokenRequest,Abblix.Oidc.Server.Features.ClientInformation.ClientInfo)}

Asynchronously processes the token request using the JWT Bearer grant type\.
Validates the JWT assertion and, if valid, issues an access token\.

```csharp
public System.Threading.Tasks.Task<Abblix.Utils.Result<Abblix.Oidc.Server.Endpoints.Token.Interfaces.AuthorizedGrant,Abblix.Oidc.Server.Common.OidcError>> AuthorizeAsync(Abblix.Oidc.Server.Model.TokenRequest request, Abblix.Oidc.Server.Features.ClientInformation.ClientInfo clientInfo);
```
#### Parameters

###### `request` [TokenRequest](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Model.TokenRequest 'Abblix\.Oidc\.Server\.Model\.TokenRequest') {#Abblix.Oidc.Server.Endpoints.Token.Grants.JwtBearerGrantHandler.AuthorizeAsync(Abblix.Oidc.Server.Model.TokenRequest,Abblix.Oidc.Server.Features.ClientInformation.ClientInfo).request}

The token request containing the JWT assertion and requested scope\.

###### `clientInfo` [ClientInfo](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.ClientInformation.ClientInfo 'Abblix\.Oidc\.Server\.Features\.ClientInformation\.ClientInfo') {#Abblix.Oidc.Server.Endpoints.Token.Grants.JwtBearerGrantHandler.AuthorizeAsync(Abblix.Oidc.Server.Model.TokenRequest,Abblix.Oidc.Server.Features.ClientInformation.ClientInfo).clientInfo}

Information about the authenticated client making the request\.

Implements [AuthorizeAsync\(TokenRequest, ClientInfo\)](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Endpoints.Token.Grants.IAuthorizationGrantHandler#Abblix.Oidc.Server.Endpoints.Token.Grants.IAuthorizationGrantHandler.AuthorizeAsync(Abblix.Oidc.Server.Model.TokenRequest,Abblix.Oidc.Server.Features.ClientInformation.ClientInfo) 'Abblix\.Oidc\.Server\.Endpoints\.Token\.Grants\.IAuthorizationGrantHandler\.AuthorizeAsync\(Abblix\.Oidc\.Server\.Model\.TokenRequest, Abblix\.Oidc\.Server\.Features\.ClientInformation\.ClientInfo\)')

#### Returns
[System\.Threading\.Tasks\.Task&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1 'System\.Threading\.Tasks\.Task\`1')[Abblix\.Utils\.Result&lt;](https://learn.microsoft.com/en-us/dotnet/api/abblix.utils.result-2 'Abblix\.Utils\.Result\`2')[AuthorizedGrant](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Endpoints.Token.Interfaces.AuthorizedGrant 'Abblix\.Oidc\.Server\.Endpoints\.Token\.Interfaces\.AuthorizedGrant')[,](https://learn.microsoft.com/en-us/dotnet/api/abblix.utils.result-2 'Abblix\.Utils\.Result\`2')[OidcError](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Common.OidcError 'Abblix\.Oidc\.Server\.Common\.OidcError')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/abblix.utils.result-2 'Abblix\.Utils\.Result\`2')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1 'System\.Threading\.Tasks\.Task\`1')  
A task that completes with either an authorized grant containing the user session and context,
or an error indicating why the JWT assertion was rejected\.
