2026-02-06 19:58:01 +01:00
|
|
|
using System.Text.Json.Serialization;
|
|
|
|
|
|
2026-02-14 14:54:48 +01:00
|
|
|
namespace IdentityShroud.Core.DTO;
|
2026-02-06 19:58:01 +01:00
|
|
|
|
|
|
|
|
public class JsonWebTokenHeader
|
|
|
|
|
{
|
|
|
|
|
[JsonPropertyName("alg")]
|
|
|
|
|
public string Algorithm { get; set; } = "HS256";
|
|
|
|
|
[JsonPropertyName("typ")]
|
|
|
|
|
public string Type { get; set; } = "JWT";
|
|
|
|
|
[JsonPropertyName("kid")]
|
2026-02-14 14:54:48 +01:00
|
|
|
public required string KeyId { get; set; }
|
2026-02-06 19:58:01 +01:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-14 14:54:48 +01:00
|
|
|
//
|
2026-02-06 19:58:01 +01:00
|
|
|
public class JsonWebTokenPayload
|
|
|
|
|
{
|
|
|
|
|
[JsonPropertyName("iss")]
|
2026-02-14 14:54:48 +01:00
|
|
|
public string? Issuer { get; set; }
|
2026-02-06 19:58:01 +01:00
|
|
|
[JsonPropertyName("aud")]
|
2026-02-14 14:54:48 +01:00
|
|
|
public string[]? Audience { get; set; }
|
2026-02-06 19:58:01 +01:00
|
|
|
[JsonPropertyName("sub")]
|
2026-02-14 14:54:48 +01:00
|
|
|
public string? Subject { get; set; }
|
2026-02-06 19:58:01 +01:00
|
|
|
[JsonPropertyName("exp")]
|
2026-02-14 14:54:48 +01:00
|
|
|
public long? Expires { get; set; }
|
2026-02-06 19:58:01 +01:00
|
|
|
[JsonPropertyName("iat")]
|
2026-02-14 14:54:48 +01:00
|
|
|
public long? IssuedAt { get; set; }
|
2026-02-06 19:58:01 +01:00
|
|
|
[JsonPropertyName("nbf")]
|
2026-02-14 14:54:48 +01:00
|
|
|
public long? NotBefore { get; set; }
|
2026-02-06 19:58:01 +01:00
|
|
|
[JsonPropertyName("jti")]
|
2026-02-14 14:54:48 +01:00
|
|
|
public Guid? JwtId { get; set; }
|
2026-02-06 19:58:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class JsonWebToken
|
|
|
|
|
{
|
2026-02-14 14:54:48 +01:00
|
|
|
public required JsonWebTokenHeader Header { get; set; }
|
|
|
|
|
public required JsonWebTokenPayload Payload { get; set; }
|
|
|
|
|
public required byte[] Signature { get; set; } = [];
|
2026-02-06 19:58:01 +01:00
|
|
|
}
|