Правка секции Authentication внутри appsettings.json
This commit is contained in:
parent
98d8a5b77f
commit
441d529373
@ -74,15 +74,16 @@ public static class DependencyInjection
|
|||||||
|
|
||||||
private static void AddKeyCloakAuthentication(this IServiceCollection services, IConfiguration configuration)
|
private static void AddKeyCloakAuthentication(this IServiceCollection services, IConfiguration configuration)
|
||||||
{
|
{
|
||||||
|
var keyCloakHost = configuration["Authentication:Audience"];
|
||||||
services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
|
services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
|
||||||
.AddJwtBearer(options =>
|
.AddJwtBearer(options =>
|
||||||
{
|
{
|
||||||
options.RequireHttpsMetadata = false;
|
options.RequireHttpsMetadata = false;
|
||||||
options.Audience = configuration["Authentication:Audience"];
|
options.Audience = configuration["Authentication:Audience"];
|
||||||
options.MetadataAddress = configuration["Authentication:MetadataAddress"]!;
|
options.MetadataAddress = $"{keyCloakHost}/.well-known/openid-configuration";
|
||||||
options.TokenValidationParameters = new TokenValidationParameters
|
options.TokenValidationParameters = new TokenValidationParameters
|
||||||
{
|
{
|
||||||
ValidIssuer = configuration["Authentication:ValidIssuer"],
|
ValidIssuer = keyCloakHost,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
},
|
},
|
||||||
"AllowedHosts": "*",
|
"AllowedHosts": "*",
|
||||||
"Authentication": {
|
"Authentication": {
|
||||||
"MetadataAddress": "http://192.168.0.10:8321/realms/Persistence/.well-known/openid-configuration",
|
|
||||||
"Audience": "account",
|
"Audience": "account",
|
||||||
"ValidIssuer": "http://192.168.0.10:8321/realms/Persistence",
|
"ValidIssuer": "http://192.168.0.10:8321/realms/Persistence",
|
||||||
"AuthorizationUrl": "http://192.168.0.10:8321/realms/Persistence/protocol/openid-connect/auth"
|
"AuthorizationUrl": "http://192.168.0.10:8321/realms/Persistence/protocol/openid-connect/auth"
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
},
|
},
|
||||||
"AllowedHosts": "*",
|
"AllowedHosts": "*",
|
||||||
"Authentication": {
|
"Authentication": {
|
||||||
"MetadataAddress": "http://192.168.0.10:8321/realms/Persistence/.well-known/openid-configuration",
|
|
||||||
"Audience": "account",
|
"Audience": "account",
|
||||||
"ValidIssuer": "http://192.168.0.10:8321/realms/Persistence",
|
"ValidIssuer": "http://192.168.0.10:8321/realms/Persistence",
|
||||||
"AuthorizationUrl": "http://192.168.0.10:8321/realms/Persistence/protocol/openid-connect/auth"
|
"AuthorizationUrl": "http://192.168.0.10:8321/realms/Persistence/protocol/openid-connect/auth"
|
||||||
|
Loading…
Reference in New Issue
Block a user