using System;
using System.Text.Json.Serialization;
namespace CarpaNet.OAuth;
///
/// OAuth 2.0 Client Metadata.
///
public sealed class OAuthClientMetadata
{
///
/// The client identifier.
///
[JsonPropertyName("client_id")]
public string ClientId { get; set; } = string.Empty;
///
/// Array of redirect URIs.
///
[JsonPropertyName("redirect_uris")]
public string[] RedirectUris { get; set; } = Array.Empty();
///
/// Response types the client uses.
///
[JsonPropertyName("response_types")]
public string[]? ResponseTypes { get; set; }
///
/// Grant types the client uses.
///
[JsonPropertyName("grant_types")]
public string[]? GrantTypes { get; set; }
///
/// Requested scope.
///
[JsonPropertyName("scope")]
public string? Scope { get; set; }
///
/// Token endpoint authentication method.
///
[JsonPropertyName("token_endpoint_auth_method")]
public string? TokenEndpointAuthMethod { get; set; }
///
/// Token endpoint authentication signing algorithm.
///
[JsonPropertyName("token_endpoint_auth_signing_alg")]
public string? TokenEndpointAuthSigningAlg { get; set; }
///
/// JWK Set containing client's public keys.
///
[JsonPropertyName("jwks")]
public JsonWebKeySet? Jwks { get; set; }
///
/// URL of the client's JWK Set.
///
[JsonPropertyName("jwks_uri")]
public string? JwksUri { get; set; }
///
/// Application type (web or native).
///
[JsonPropertyName("application_type")]
public string? ApplicationType { get; set; }
///
/// Human-readable client name.
///
[JsonPropertyName("client_name")]
public string? ClientName { get; set; }
///
/// URL of the client's home page.
///
[JsonPropertyName("client_uri")]
public string? ClientUri { get; set; }
///
/// URL of the client's logo.
///
[JsonPropertyName("logo_uri")]
public string? LogoUri { get; set; }
///
/// Whether access tokens must be DPoP-bound.
///
[JsonPropertyName("dpop_bound_access_tokens")]
public bool DpopBoundAccessTokens { get; set; }
}
///
/// JSON Web Key Set.
///
public sealed class JsonWebKeySet
{
///
/// Array of JSON Web Keys.
///
[JsonPropertyName("keys")]
public JsonWebKey[] Keys { get; set; } = Array.Empty();
}
///
/// JSON Web Key (RFC 7517).
///
public sealed class JsonWebKey
{
///
/// Key type (e.g., "EC", "RSA", "OKP").
///
[JsonPropertyName("kty")]
public string Kty { get; set; } = string.Empty;
///
/// Key ID.
///
[JsonPropertyName("kid")]
public string? Kid { get; set; }
///
/// Intended use (e.g., "sig", "enc").
///
[JsonPropertyName("use")]
public string? Use { get; set; }
///
/// Key operations.
///
[JsonPropertyName("key_ops")]
public string[]? KeyOps { get; set; }
///
/// Algorithm.
///
[JsonPropertyName("alg")]
public string? Alg { get; set; }
///
/// Curve (for EC and OKP keys).
///
[JsonPropertyName("crv")]
public string? Crv { get; set; }
///
/// X coordinate (for EC keys).
///
[JsonPropertyName("x")]
public string? X { get; set; }
///
/// Y coordinate (for EC keys).
///
[JsonPropertyName("y")]
public string? Y { get; set; }
///
/// Private key value (for EC keys). Only present in private keys.
///
[JsonPropertyName("d")]
public string? D { get; set; }
///
/// RSA modulus.
///
[JsonPropertyName("n")]
public string? N { get; set; }
///
/// RSA public exponent.
///
[JsonPropertyName("e")]
public string? E { get; set; }
}