| | | 1 | | namespace Syki.Back.Settings; |
| | | 2 | | |
| | | 3 | | public class AuthSettings : SettingsBase |
| | | 4 | | { |
| | 262 | 5 | | public string Issuer { get; set; } |
| | 262 | 6 | | public string Audience { get; set; } |
| | 262 | 7 | | public string SecurityKey { get; set; } |
| | 260 | 8 | | public int ExpirationTimeInMinutes { get; set; } |
| | 8 | 9 | | public string? CookieDomain { get; set; } |
| | 284 | 10 | | public bool CookieSecure { get; set; } = true; |
| | 288 | 11 | | public SameSiteMode CookieSameSite { get; set; } = SameSiteMode.Lax; |
| | | 12 | | |
| | 4 | 13 | | public AuthSettings(IConfiguration configuration) |
| | | 14 | | { |
| | 4 | 15 | | configuration.GetSection("Auth").Bind(this); |
| | | 16 | | |
| | 4 | 17 | | RequireNonEmpty(Issuer); |
| | 4 | 18 | | RequireNonEmpty(Audience); |
| | 4 | 19 | | RequireNonEmpty(SecurityKey); |
| | 4 | 20 | | RequirePositive(ExpirationTimeInMinutes); |
| | 4 | 21 | | } |
| | | 22 | | } |
| | | 23 | | |
| | | 24 | | public static class AuthSettingsExtensions |
| | | 25 | | { |
| | | 26 | | extension(IConfiguration configuration) |
| | | 27 | | { |
| | | 28 | | public AuthSettings Auth => new(configuration); |
| | | 29 | | } |
| | | 30 | | } |