40 lines
No EOL
1.1 KiB
C#
40 lines
No EOL
1.1 KiB
C#
using System.Text.Json.Serialization;
|
|
|
|
namespace IdentityShroud.Core.DTO;
|
|
|
|
public class JsonWebTokenHeader
|
|
{
|
|
[JsonPropertyName("alg")]
|
|
public string Algorithm { get; set; } = "HS256";
|
|
[JsonPropertyName("typ")]
|
|
public string Type { get; set; } = "JWT";
|
|
[JsonPropertyName("kid")]
|
|
public required string KeyId { get; set; }
|
|
|
|
}
|
|
|
|
//
|
|
public class JsonWebTokenPayload
|
|
{
|
|
[JsonPropertyName("iss")]
|
|
public string? Issuer { get; set; }
|
|
[JsonPropertyName("aud")]
|
|
public string[]? Audience { get; set; }
|
|
[JsonPropertyName("sub")]
|
|
public string? Subject { get; set; }
|
|
[JsonPropertyName("exp")]
|
|
public long? Expires { get; set; }
|
|
[JsonPropertyName("iat")]
|
|
public long? IssuedAt { get; set; }
|
|
[JsonPropertyName("nbf")]
|
|
public long? NotBefore { get; set; }
|
|
[JsonPropertyName("jti")]
|
|
public Guid? JwtId { get; set; }
|
|
}
|
|
|
|
public class JsonWebToken
|
|
{
|
|
public required JsonWebTokenHeader Header { get; set; }
|
|
public required JsonWebTokenPayload Payload { get; set; }
|
|
public required byte[] Signature { get; set; } = [];
|
|
} |