namespace Bifrost.Web.Configuration; /// /// The OIDC provider surface (section Bifrost:Oidc). An absent section means the provider is not mapped at /// all; a present section is complete or startup fails. Keys and the client secret are named by file path, never inlined. /// public sealed class OidcIssuerOptions { public const string SectionName = "Bifrost:Oidc"; /// PEM file holding the EC P-256 private key that signs tokens (ES256). public string SigningKeyPath { get; init; } = string.Empty; /// File holding the 32-byte symmetric token-encryption key as base64. public string EncryptionKeyPath { get; init; } = string.Empty; public OidcClientsOptions Clients { get; init; } = new(); /// Null when the section is absent. public static OidcIssuerOptions? FromConfiguration(IConfiguration configuration) { var section = configuration.GetSection(SectionName); return section.Exists() ? section.Get() ?? new OidcIssuerOptions() : null; } } public sealed class OidcClientsOptions { /// Matrix Authentication Service, the one client of this provider. public OidcClientOptions Mas { get; init; } = new(); } public sealed class OidcClientOptions { public string ClientId { get; init; } = string.Empty; /// File holding the client secret. public string ClientSecretPath { get; init; } = string.Empty; public string RedirectUri { get; init; } = string.Empty; /// MAS's back-channel logout URL for this provider. Empty: no logout is sent and no session is ended. public string BackchannelLogoutUri { get; init; } = string.Empty; }