Fixes some warnings.
This commit is contained in:
parent
d440979451
commit
ed52e2f789
3 changed files with 25 additions and 17 deletions
|
|
@ -1,8 +1,10 @@
|
|||
using System.Text.Json.Serialization;
|
||||
using IdentityShroud.Core.Messages;
|
||||
using IdentityShroud.Core.Messages.Realm;
|
||||
using Microsoft.Extensions.Diagnostics.HealthChecks;
|
||||
|
||||
[JsonSerializable(typeof(OpenIdConfiguration))]
|
||||
[JsonSerializable(typeof(RealmCreateRequest))]
|
||||
internal partial class AppJsonSerializerContext : JsonSerializerContext
|
||||
{
|
||||
}
|
||||
|
|
@ -2,26 +2,31 @@ using System.Text.Json.Serialization;
|
|||
|
||||
namespace IdentityShroud.Core.Messages;
|
||||
|
||||
// https://www.rfc-editor.org/rfc/rfc7517.html
|
||||
|
||||
|
||||
public class JsonWebKey
|
||||
{
|
||||
[JsonPropertyName("kty")]
|
||||
public string KeyType { get; set; } = "RSA";
|
||||
|
||||
// Common values sig(nature) enc(ryption)
|
||||
[JsonPropertyName("use")]
|
||||
public string Use { get; set; } = "sig"; // "sig" for signature, "enc" for encryption
|
||||
public string? Use { get; set; } = "sig"; // "sig" for signature, "enc" for encryption
|
||||
|
||||
// Per standard this field is optional for now we will use RS256
|
||||
[JsonPropertyName("alg")]
|
||||
public string Algorithm { get; set; } = "RS256";
|
||||
public string? Algorithm { get; set; } = "RS256";
|
||||
|
||||
[JsonPropertyName("kid")]
|
||||
public string KeyId { get; set; }
|
||||
public required string KeyId { get; set; }
|
||||
|
||||
// RSA Public Key Components
|
||||
[JsonPropertyName("n")]
|
||||
public string Modulus { get; set; }
|
||||
public required string Modulus { get; set; }
|
||||
|
||||
[JsonPropertyName("e")]
|
||||
public string Exponent { get; set; }
|
||||
public required string Exponent { get; set; }
|
||||
|
||||
// Optional fields
|
||||
[JsonPropertyName("x5c")]
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace IdentityShroud.Core.Messages;
|
||||
namespace IdentityShroud.Core.DTO;
|
||||
|
||||
public class JsonWebTokenHeader
|
||||
{
|
||||
|
|
@ -9,31 +9,32 @@ public class JsonWebTokenHeader
|
|||
[JsonPropertyName("typ")]
|
||||
public string Type { get; set; } = "JWT";
|
||||
[JsonPropertyName("kid")]
|
||||
public string KeyId { get; set; }
|
||||
public required string KeyId { get; set; }
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
public class JsonWebTokenPayload
|
||||
{
|
||||
[JsonPropertyName("iss")]
|
||||
public string Issuer { get; set; }
|
||||
public string? Issuer { get; set; }
|
||||
[JsonPropertyName("aud")]
|
||||
public string[] Audience { get; set; }
|
||||
public string[]? Audience { get; set; }
|
||||
[JsonPropertyName("sub")]
|
||||
public string Subject { get; set; }
|
||||
public string? Subject { get; set; }
|
||||
[JsonPropertyName("exp")]
|
||||
public long Expires { get; set; }
|
||||
public long? Expires { get; set; }
|
||||
[JsonPropertyName("iat")]
|
||||
public long IssuedAt { get; set; }
|
||||
public long? IssuedAt { get; set; }
|
||||
[JsonPropertyName("nbf")]
|
||||
public long NotBefore { get; set; }
|
||||
public long? NotBefore { get; set; }
|
||||
[JsonPropertyName("jti")]
|
||||
public Guid JwtId { get; set; }
|
||||
public Guid? JwtId { get; set; }
|
||||
}
|
||||
|
||||
public class JsonWebToken
|
||||
{
|
||||
public JsonWebTokenHeader Header { get; set; } = new();
|
||||
public JsonWebTokenPayload Payload { get; set; } = new();
|
||||
public byte[] Signature { get; set; } = [];
|
||||
public required JsonWebTokenHeader Header { get; set; }
|
||||
public required JsonWebTokenPayload Payload { get; set; }
|
||||
public required byte[] Signature { get; set; } = [];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue