Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f8153e86b4 | |||
| eef1096ec5 | |||
| 84d33d3607 | |||
| 8f97d7cf38 | |||
| f51cc03327 | |||
| 652ca82a57 |
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"FeatureManagement": {
|
"FeatureManagement": {
|
||||||
"CategorySeederService": true,
|
"CategorySeederService": false,
|
||||||
"CustomerSeederService": false,
|
"CustomerSeederService": false,
|
||||||
"ProductsSeederService": false
|
"ProductsSeederService": false
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
## Authentik Token Request
|
### Authentik Token Request (Service Account Explicit)
|
||||||
POST {{authority}}
|
POST {{authority}}
|
||||||
Content-Type: application/x-www-form-urlencoded
|
Content-Type: application/x-www-form-urlencoded
|
||||||
Accept-Encoding: identity
|
Accept-Encoding: identity
|
||||||
|
|
||||||
grant_type={{grantType}}&client_id={{clientId}}&client_secret={{clientSecret}}&username={{username}}&password={{password}}&scope={{scope}}
|
grant_type={{grantType}}&client_id={{clientId}}&username={{username}}&password={{password}}&scope={{scope}}
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ public sealed class AuthentikSettings
|
|||||||
{
|
{
|
||||||
public string? Authority { get; set; }
|
public string? Authority { get; set; }
|
||||||
|
|
||||||
|
public string? IntrospectionUrl { get; set; }
|
||||||
|
|
||||||
public string? ApiResourceName { get; set; }
|
public string? ApiResourceName { get; set; }
|
||||||
|
|
||||||
public string? ApiResourceSecret { get; set; }
|
public string? ApiResourceSecret { get; set; }
|
||||||
@@ -13,6 +15,4 @@ public sealed class AuthentikSettings
|
|||||||
public string? RequiredClaimNameValue { get; set; }
|
public string? RequiredClaimNameValue { get; set; }
|
||||||
|
|
||||||
public bool RequireHttpsMetadata { get; set; }
|
public bool RequireHttpsMetadata { get; set; }
|
||||||
|
|
||||||
public bool BypassSslErrors { get; set; }
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,18 +22,20 @@ public static class Api
|
|||||||
.AddOAuth2Introspection(OAuth2IntrospectionDefaults.AuthenticationScheme, options =>
|
.AddOAuth2Introspection(OAuth2IntrospectionDefaults.AuthenticationScheme, options =>
|
||||||
{
|
{
|
||||||
options.Authority = authOptions.Authority;
|
options.Authority = authOptions.Authority;
|
||||||
|
options.IntrospectionEndpoint = authOptions.IntrospectionUrl;
|
||||||
options.ClientId = authOptions.ApiResourceName;
|
options.ClientId = authOptions.ApiResourceName;
|
||||||
options.ClientSecret = authOptions.ApiResourceSecret;
|
options.ClientSecret = authOptions.ApiResourceSecret;
|
||||||
|
|
||||||
|
options.NameClaimType = "sub";
|
||||||
options.DiscoveryPolicy.RequireHttps = authOptions.RequireHttpsMetadata;
|
options.DiscoveryPolicy.RequireHttps = authOptions.RequireHttpsMetadata;
|
||||||
options.EnableCaching = true;
|
options.DiscoveryPolicy.ValidateEndpoints = false;
|
||||||
options.CacheDuration = TimeSpan.FromMinutes(10);
|
options.EnableCaching = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(authOptions.RequiredClaimName) && !string.IsNullOrWhiteSpace(authOptions.RequiredClaimNameValue))
|
if (!string.IsNullOrWhiteSpace(authOptions.RequiredClaimName) && !string.IsNullOrWhiteSpace(authOptions.RequiredClaimNameValue))
|
||||||
{
|
{
|
||||||
services.AddAuthorizationBuilder()
|
services.AddAuthorizationBuilder()
|
||||||
.AddPolicy("ApiScope", policy =>
|
.AddPolicy("RequiredScope", policy =>
|
||||||
policy.RequireClaim(authOptions.RequiredClaimName, authOptions.RequiredClaimNameValue));
|
policy.RequireClaim(authOptions.RequiredClaimName, authOptions.RequiredClaimNameValue));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ namespace LiteCharms.Features.Hasher;
|
|||||||
|
|
||||||
public sealed partial class HashService(IHashids hasher) : IService
|
public sealed partial class HashService(IHashids hasher) : IService
|
||||||
{
|
{
|
||||||
[GeneratedRegex(@"\A\b[0-9a-fA-F]+\b\Z")]
|
[GeneratedRegex(@"\A\b[0-9a-fA-F]+\b\Z", RegexOptions.None, matchTimeoutMilliseconds: 100)]
|
||||||
private static partial Regex HexHashRegex { get; }
|
private static partial Regex HexHashRegex { get; }
|
||||||
|
|
||||||
[GeneratedRegex(@"\A[0-9a-fA-F]{32}\Z", RegexOptions.None, matchTimeoutMilliseconds: 100)]
|
[GeneratedRegex(@"\A[0-9a-fA-F]{32}\Z", RegexOptions.None, matchTimeoutMilliseconds: 100)]
|
||||||
|
|||||||
Reference in New Issue
Block a user