namespace GiteaMcp.Config;
///
/// JWT 验签配置。
/// 环境变量:Jwt__Algorithm, Jwt__Issuer, Jwt__Audience, Jwt__SigningKey__Current, Jwt__SigningKey__Previous
///
public class JwtOptions
{
public const string SectionName = "Jwt";
///
/// JWT 签名算法。
///
/// - HS256(默认):与 AS 共享对称密钥(SigningKey.Current 必填)。适合自建极简 AS。
/// - RS256:从 Issuer 走 OIDC discovery 自动拉 JWKS(含自动刷新)。
/// 适合任何标准 OAuth 2.1 / OIDC AS(Logto / ZITADEL / Keycloak / Auth0 等)。
/// 要求 Issuer 暴露 /.well-known/openid-configuration。
///
///
public string Algorithm { get; set; } = "HS256";
/// 期望的 iss claim(你的 auth server 的 issuer URL),必须通过 env 注入
public string Issuer { get; set; } = string.Empty;
/// 期望的 aud claim,默认 gitea
public string Audience { get; set; } = "gitea";
/// HS256 模式使用;RS256 模式下忽略。
public SigningKeyPair SigningKey { get; set; } = new();
public class SigningKeyPair
{
/// 当前签名密钥(HS256 对称密钥),env: Jwt__SigningKey__Current
public string Current { get; set; } = string.Empty;
/// 上一轮密钥,密钥轮换过渡期用,env: Jwt__SigningKey__Previous(可为空)
public string? Previous { get; set; }
}
}