Class JwtValidationResult
The resulting object from a JWT-validation induced via ValidateToken(String, TokenValidationParameters).
Inheritance
Inherited Members
Namespace: GlitchedPolygons.Services.JwtService
Assembly: GlitchedPolygons.Services.JwtService.dll
Syntax
public class JwtValidationResult
Constructors
| Improve this Doc View SourceJwtValidationResult(Tuple<JwtSecurityToken, IPrincipal>, Exception, String)
Creates a JwtValidationResult instance.
Declaration
public JwtValidationResult(Tuple<JwtSecurityToken, IPrincipal> validatedToken, Exception exception, string errorMessage)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Tuple<System.IdentityModel.Tokens.Jwt.JwtSecurityToken, System.Security.Principal.IPrincipal> | validatedToken | The validated token's System.Tuple containing both the decoded System.IdentityModel.Tokens.Jwt.JwtSecurityToken and the System.Security.Principal.IPrincipal instance with all of its mapped System.Security.Claims.Claims. |
| System.Exception | exception | The thrown Exception in case of a failure. |
| System.String | errorMessage | The error message |
Properties
| Improve this Doc View SourceClaims
Gets the associated token's claims (from the JWT payload).
Declaration
public IEnumerable<Claim> Claims { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<System.Security.Claims.Claim> |
ErrorMessage
The error message string in case of a failure.
Declaration
public string ErrorMessage { get; }
Property Value
| Type | Description |
|---|---|
| System.String |
Exception
The thrown Exception in case of a failure.
Declaration
public Exception Exception { get; }
Property Value
| Type | Description |
|---|---|
| System.Exception |
Item[String]
Get the token's claim by type name (claims are key-value strings inside the JWT's payload json).
Declaration
public Claim this[string claimKey] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | claimKey | The claim key (System.Security.Claims.Claim.Type). |
Property Value
| Type | Description |
|---|---|
| System.Security.Claims.Claim | The System.Security.Claims.Claim value if it was found inside the JWT claims payload; |
Successful
Was the validation successful?
Declaration
public bool Successful { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
ValidatedToken
The validated token containing all of its linked System.Security.Claims.Claims and other payload elements.
It's a System.Tuple<T1, T2> containing both the raw, validated System.IdentityModel.Tokens.Jwt.JwtSecurityToken and the deserialized System.Security.Principal.IPrincipal instance.
Declaration
public Tuple<JwtSecurityToken, IPrincipal> ValidatedToken { get; }
Property Value
| Type | Description |
|---|---|
| System.Tuple<System.IdentityModel.Tokens.Jwt.JwtSecurityToken, System.Security.Principal.IPrincipal> |