#### [Abblix\.Jwt](https://www.abblix.com/docs/api/abblix-jwt 'index')
### [Abblix\.Jwt](https://www.abblix.com/docs/api/abblix-jwt/Abblix.Jwt 'Abblix\.Jwt')

## TokenTypePolicy Class

Which `typ` header values \(RFC 7515 section 4\.1\.9\) a validation accepts, so that a token signed for one
purpose cannot be presented as another by a recipient trusting the same issuer for several \(RFC 8725
section 3\.11\)\.

```csharp
public sealed record TokenTypePolicy : System.IEquatable<Abblix.Jwt.TokenTypePolicy>
```

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

Implements [System\.IEquatable&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.iequatable-1 'System\.IEquatable\`1')[TokenTypePolicy](https://www.abblix.com/docs/api/abblix-jwt/Abblix.Jwt.TokenTypePolicy 'Abblix\.Jwt\.TokenTypePolicy')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.iequatable-1 'System\.IEquatable\`1')

### Remarks
Every validation states one: [TokenTypes](https://www.abblix.com/docs/api/abblix-jwt/Abblix.Jwt.ValidationParameters#Abblix.Jwt.ValidationParameters.TokenTypes 'Abblix\.Jwt\.ValidationParameters\.TokenTypes') has no default, because a default
that skipped the check would leave a type unchecked without anybody deciding it should be\.

Matching is case-insensitive and accepts either spelling of the `application/` prefix on either side, so
`at+jwt` and `application/AT+JWT` name the same type, as RFC 7515 section 4.1.9 requires of a media
type.
### Fields

## TokenTypePolicy\.CheckedByCaller Field {#Abblix.Jwt.TokenTypePolicy.CheckedByCaller}

Leaves the `typ` header to the caller, which judges it after validation, as a deliberate and named
choice rather than a missing setting\.

```csharp
public static readonly TokenTypePolicy CheckedByCaller;
```

#### Field Value
[TokenTypePolicy](https://www.abblix.com/docs/api/abblix-jwt/Abblix.Jwt.TokenTypePolicy 'Abblix\.Jwt\.TokenTypePolicy')
### Properties

## TokenTypePolicy\.Rule Property {#Abblix.Jwt.TokenTypePolicy.Rule}

How the `typ` header is judged\.

```csharp
public Abblix.Jwt.TokenTypeRule Rule { get; }
```

#### Property Value
[TokenTypeRule](https://www.abblix.com/docs/api/abblix-jwt/Abblix.Jwt.TokenTypeRule 'Abblix\.Jwt\.TokenTypeRule')

## TokenTypePolicy\.Types Property {#Abblix.Jwt.TokenTypePolicy.Types}

The accepted `typ` values; empty for [CheckedByCaller](https://www.abblix.com/docs/api/abblix-jwt/Abblix.Jwt.TokenTypePolicy#Abblix.Jwt.TokenTypePolicy.CheckedByCaller 'Abblix\.Jwt\.TokenTypePolicy\.CheckedByCaller'), and for
[OrUntyped\(string\[\]\)](https://www.abblix.com/docs/api/abblix-jwt/Abblix.Jwt.TokenTypePolicy#Abblix.Jwt.TokenTypePolicy.OrUntyped(string[]) 'Abblix\.Jwt\.TokenTypePolicy\.OrUntyped\(string\[\]\)') when only a token without a type is accepted\.

```csharp
public System.Collections.Generic.IReadOnlyList<string> Types { get; }
```

#### Property Value
[System\.Collections\.Generic\.IReadOnlyList&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.ireadonlylist-1 'System\.Collections\.Generic\.IReadOnlyList\`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.ireadonlylist-1 'System\.Collections\.Generic\.IReadOnlyList\`1')
### Methods

## TokenTypePolicy\.Exactly\(string\[\]\) Method {#Abblix.Jwt.TokenTypePolicy.Exactly(string[])}

Accepts a token whose `typ` names one of [types](https://www.abblix.com/docs/api/abblix-jwt/Abblix.Jwt.TokenTypePolicy#Abblix.Jwt.TokenTypePolicy.Exactly(string[]).types 'Abblix\.Jwt\.TokenTypePolicy\.Exactly\(string\[\]\)\.types'), and refuses one without a type\.

```csharp
public static Abblix.Jwt.TokenTypePolicy Exactly(params string[] types);
```
#### Parameters

###### `types` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String')[\[\]](https://learn.microsoft.com/en-us/dotnet/api/system.array 'System\.Array') {#Abblix.Jwt.TokenTypePolicy.Exactly(string[]).types}

The accepted values, at least one\.

#### Returns
[TokenTypePolicy](https://www.abblix.com/docs/api/abblix-jwt/Abblix.Jwt.TokenTypePolicy 'Abblix\.Jwt\.TokenTypePolicy')

## TokenTypePolicy\.OrUntyped\(string\[\]\) Method {#Abblix.Jwt.TokenTypePolicy.OrUntyped(string[])}

Accepts a token whose `typ` names one of [types](https://www.abblix.com/docs/api/abblix-jwt/Abblix.Jwt.TokenTypePolicy#Abblix.Jwt.TokenTypePolicy.OrUntyped(string[]).types 'Abblix\.Jwt\.TokenTypePolicy\.OrUntyped\(string\[\]\)\.types') or that carries no `typ`, for a
token whose specification leaves its type optional\. With no types, only an untyped token is accepted\.

```csharp
public static Abblix.Jwt.TokenTypePolicy OrUntyped(params string[] types);
```
#### Parameters

###### `types` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String')[\[\]](https://learn.microsoft.com/en-us/dotnet/api/system.array 'System\.Array') {#Abblix.Jwt.TokenTypePolicy.OrUntyped(string[]).types}

The accepted values besides absence\.

#### Returns
[TokenTypePolicy](https://www.abblix.com/docs/api/abblix-jwt/Abblix.Jwt.TokenTypePolicy 'Abblix\.Jwt\.TokenTypePolicy')
