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 System.Text.Json.Serialization;
|
||||||
using IdentityShroud.Core.Messages;
|
using IdentityShroud.Core.Messages;
|
||||||
|
using IdentityShroud.Core.Messages.Realm;
|
||||||
using Microsoft.Extensions.Diagnostics.HealthChecks;
|
using Microsoft.Extensions.Diagnostics.HealthChecks;
|
||||||
|
|
||||||
[JsonSerializable(typeof(OpenIdConfiguration))]
|
[JsonSerializable(typeof(OpenIdConfiguration))]
|
||||||
|
[JsonSerializable(typeof(RealmCreateRequest))]
|
||||||
internal partial class AppJsonSerializerContext : JsonSerializerContext
|
internal partial class AppJsonSerializerContext : JsonSerializerContext
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
@ -2,26 +2,31 @@ using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace IdentityShroud.Core.Messages;
|
namespace IdentityShroud.Core.Messages;
|
||||||
|
|
||||||
|
// https://www.rfc-editor.org/rfc/rfc7517.html
|
||||||
|
|
||||||
|
|
||||||
public class JsonWebKey
|
public class JsonWebKey
|
||||||
{
|
{
|
||||||
[JsonPropertyName("kty")]
|
[JsonPropertyName("kty")]
|
||||||
public string KeyType { get; set; } = "RSA";
|
public string KeyType { get; set; } = "RSA";
|
||||||
|
|
||||||
|
// Common values sig(nature) enc(ryption)
|
||||||
[JsonPropertyName("use")]
|
[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")]
|
[JsonPropertyName("alg")]
|
||||||
public string Algorithm { get; set; } = "RS256";
|
public string? Algorithm { get; set; } = "RS256";
|
||||||
|
|
||||||
[JsonPropertyName("kid")]
|
[JsonPropertyName("kid")]
|
||||||
public string KeyId { get; set; }
|
public required string KeyId { get; set; }
|
||||||
|
|
||||||
// RSA Public Key Components
|
// RSA Public Key Components
|
||||||
[JsonPropertyName("n")]
|
[JsonPropertyName("n")]
|
||||||
public string Modulus { get; set; }
|
public required string Modulus { get; set; }
|
||||||
|
|
||||||
[JsonPropertyName("e")]
|
[JsonPropertyName("e")]
|
||||||
public string Exponent { get; set; }
|
public required string Exponent { get; set; }
|
||||||
|
|
||||||
// Optional fields
|
// Optional fields
|
||||||
[JsonPropertyName("x5c")]
|
[JsonPropertyName("x5c")]
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace IdentityShroud.Core.Messages;
|
namespace IdentityShroud.Core.DTO;
|
||||||
|
|
||||||
public class JsonWebTokenHeader
|
public class JsonWebTokenHeader
|
||||||
{
|
{
|
||||||
|
|
@ -9,31 +9,32 @@ public class JsonWebTokenHeader
|
||||||
[JsonPropertyName("typ")]
|
[JsonPropertyName("typ")]
|
||||||
public string Type { get; set; } = "JWT";
|
public string Type { get; set; } = "JWT";
|
||||||
[JsonPropertyName("kid")]
|
[JsonPropertyName("kid")]
|
||||||
public string KeyId { get; set; }
|
public required string KeyId { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
public class JsonWebTokenPayload
|
public class JsonWebTokenPayload
|
||||||
{
|
{
|
||||||
[JsonPropertyName("iss")]
|
[JsonPropertyName("iss")]
|
||||||
public string Issuer { get; set; }
|
public string? Issuer { get; set; }
|
||||||
[JsonPropertyName("aud")]
|
[JsonPropertyName("aud")]
|
||||||
public string[] Audience { get; set; }
|
public string[]? Audience { get; set; }
|
||||||
[JsonPropertyName("sub")]
|
[JsonPropertyName("sub")]
|
||||||
public string Subject { get; set; }
|
public string? Subject { get; set; }
|
||||||
[JsonPropertyName("exp")]
|
[JsonPropertyName("exp")]
|
||||||
public long Expires { get; set; }
|
public long? Expires { get; set; }
|
||||||
[JsonPropertyName("iat")]
|
[JsonPropertyName("iat")]
|
||||||
public long IssuedAt { get; set; }
|
public long? IssuedAt { get; set; }
|
||||||
[JsonPropertyName("nbf")]
|
[JsonPropertyName("nbf")]
|
||||||
public long NotBefore { get; set; }
|
public long? NotBefore { get; set; }
|
||||||
[JsonPropertyName("jti")]
|
[JsonPropertyName("jti")]
|
||||||
public Guid JwtId { get; set; }
|
public Guid? JwtId { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class JsonWebToken
|
public class JsonWebToken
|
||||||
{
|
{
|
||||||
public JsonWebTokenHeader Header { get; set; } = new();
|
public required JsonWebTokenHeader Header { get; set; }
|
||||||
public JsonWebTokenPayload Payload { get; set; } = new();
|
public required JsonWebTokenPayload Payload { get; set; }
|
||||||
public byte[] Signature { get; set; } = [];
|
public required byte[] Signature { get; set; } = [];
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue