Update Startup.cs

This commit is contained in:
Rafsanul Hasan 2019-04-04 11:58:59 +06:00 committed by GitHub
parent 6c91cbfb54
commit d1dd16e022
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -89,9 +89,9 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator
app.UseSwagger() app.UseSwagger()
.UseSwaggerUI(c => .UseSwaggerUI(c =>
{ {
c.SwaggerEndpoint($"{ (!string.IsNullOrEmpty(pathBase) ? pathBase : string.Empty) }/swagger/v1/swagger.json", "Purchase BFF V1"); c.SwaggerEndpoint($"{ (!string.IsNullOrEmpty(pathBase) ? pathBase : string.Empty) }/swagger/v1/swagger.json", "Purchase BFF V1");
//c.ConfigureOAuth2("Microsoft.eShopOnContainers.Web.Shopping.HttpAggregatorwaggerui", "", "", "Purchase BFF Swagger UI"); //c.ConfigureOAuth2("Microsoft.eShopOnContainers.Web.Shopping.HttpAggregatorwaggerui", "", "", "Purchase BFF Swagger UI");
}); });
} }
} }
@ -114,17 +114,17 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator
options.Events = new JwtBearerEvents() options.Events = new JwtBearerEvents()
{ {
OnAuthenticationFailed = async ctx => OnAuthenticationFailed = async ctx =>
{ {
await Task.Run(() => await Task.Run(() =>
{ {
}); });
}, },
OnTokenValidated = async ctx => OnTokenValidated = async ctx =>
{ {
await Task.Run(() => await Task.Run(() =>
{ {
}); });
} }
}; };
}); });
@ -157,9 +157,9 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator
AuthorizationUrl = $"{configuration.GetValue<string>("IdentityUrlExternal")}/connect/authorize", AuthorizationUrl = $"{configuration.GetValue<string>("IdentityUrlExternal")}/connect/authorize",
TokenUrl = $"{configuration.GetValue<string>("IdentityUrlExternal")}/connect/token", TokenUrl = $"{configuration.GetValue<string>("IdentityUrlExternal")}/connect/token",
Scopes = new Dictionary<string, string>() Scopes = new Dictionary<string, string>()
{ {
{ "webshoppingagg", "Shopping Aggregator for Web Clients" } { "webshoppingagg", "Shopping Aggregator for Web Clients" }
} }
}); });
options.OperationFilter<AuthorizeCheckOperationFilter>(); options.OperationFilter<AuthorizeCheckOperationFilter>();
@ -167,12 +167,11 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator
services.AddCors(options => services.AddCors(options =>
{ {
options.AddPolicy("CorsPolicy", options.AddPolicy("CorsPolicy", builder => builder
builder => builder .SetIsOriginAllowed((host) => true)
.SetIsOriginAllowed((host) => true) .AllowAnyMethod()
.AllowAnyMethod() .AllowAnyHeader()
.AllowAnyHeader() .AllowCredentials());
.AllowCredentials());
}); });
return services; return services;