Cleanup and more fixes
This commit is contained in:
@@ -39,25 +39,6 @@ public static class DependencyInjection
|
||||
|
||||
services.AddEndpointsApiExplorer();
|
||||
|
||||
services.AddOpenApiDocument((configure, sp) =>
|
||||
{
|
||||
configure.Title = "Hutopy API";
|
||||
|
||||
// Add JWT
|
||||
configure.AddSecurity(
|
||||
"JWT",
|
||||
[],
|
||||
new OpenApiSecurityScheme
|
||||
{
|
||||
Type = OpenApiSecuritySchemeType.ApiKey,
|
||||
Name = "Authorization",
|
||||
In = OpenApiSecurityApiKeyLocation.Header,
|
||||
Description = "Type into the textbox: Bearer {your JWT token}."
|
||||
});
|
||||
|
||||
configure.OperationProcessors.Add(new AspNetCoreOperationSecurityScopeProcessor("JWT"));
|
||||
});
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
@@ -78,7 +59,8 @@ public static class DependencyInjection
|
||||
public static IServiceCollection AddAuthorizationAndAuthentication(this IServiceCollection services,
|
||||
ConfigurationManager configuration)
|
||||
{
|
||||
var authenticationBuilder = services.AddAuthentication(options =>
|
||||
var authenticationBuilder = services
|
||||
.AddAuthentication(options =>
|
||||
{
|
||||
options.DefaultScheme = JwtBearerDefaults.AuthenticationScheme;
|
||||
options.DefaultChallengeScheme = CookieAuthenticationDefaults.AuthenticationScheme;
|
||||
@@ -86,8 +68,7 @@ public static class DependencyInjection
|
||||
.AddCookie("Identity.Application", options =>
|
||||
{
|
||||
options.LoginPath = "/api/Users/login";
|
||||
})
|
||||
.AddCookie();
|
||||
});
|
||||
|
||||
var authJwt = configuration.GetSection("Authentication:Jwt");
|
||||
if (authJwt.Exists())
|
||||
|
||||
Reference in New Issue
Block a user