|
|
@ -211,7 +211,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API |
|
|
|
ConfigureAuth(app); |
|
|
|
|
|
|
|
app.UseStaticFiles(); |
|
|
|
|
|
|
|
|
|
|
|
app.UseEndpoints(endpoints => |
|
|
|
{ |
|
|
|
endpoints.MapGrpcService<BasketService>(); |
|
|
@ -253,22 +253,22 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API |
|
|
|
|
|
|
|
private void ConfigureAuthService(IServiceCollection services) |
|
|
|
{ |
|
|
|
// prevent from mapping "sub" claim to nameidentifier.
|
|
|
|
JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Remove("sub"); |
|
|
|
|
|
|
|
var identityUrl = Configuration.GetValue<string>("IdentityUrl"); |
|
|
|
|
|
|
|
services.AddAuthentication(options => |
|
|
|
{ |
|
|
|
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; |
|
|
|
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; |
|
|
|
|
|
|
|
}).AddJwtBearer(options => |
|
|
|
{ |
|
|
|
options.Authority = identityUrl; |
|
|
|
options.RequireHttpsMetadata = false; |
|
|
|
options.Audience = "basket"; |
|
|
|
}); |
|
|
|
// prevent from mapping "sub" claim to nameidentifier.
|
|
|
|
JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Remove("sub"); |
|
|
|
|
|
|
|
var identityUrl = Configuration.GetValue<string>("IdentityUrl"); |
|
|
|
|
|
|
|
services.AddAuthentication(options => |
|
|
|
{ |
|
|
|
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; |
|
|
|
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; |
|
|
|
|
|
|
|
}).AddJwtBearer(options => |
|
|
|
{ |
|
|
|
options.Authority = identityUrl; |
|
|
|
options.RequireHttpsMetadata = false; |
|
|
|
options.Audience = "basket"; |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
protected virtual void ConfigureAuth(IApplicationBuilder app) |
|
|
|