Cleanup and more fixes

This commit is contained in:
Jonathan Bourdon
2024-06-20 16:27:44 -04:00
parent ba35e3228e
commit 81e9290989
10 changed files with 57 additions and 1025 deletions

View File

@@ -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())