Skip to content

Commit

Permalink
Added requirement and auth scheme used previously
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian Brenne authored and adrianbrenne committed Nov 19, 2024
1 parent 1230840 commit 6ddc032
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using Microsoft.Extensions.DependencyInjection;
using AlvTimeWebApi.Authorization.Handlers;
using AlvTimeWebApi.Authorization.Requirements;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Authorization;

namespace AlvTimeWebApi.Authorization;
Expand All @@ -12,7 +14,9 @@ public static void AddAlvtimeAuthorization(this IServiceCollection services)
{
options.DefaultPolicy = new AuthorizationPolicyBuilder()
.RequireAuthenticatedUser()
.Build();
.AddAuthenticationSchemes("PersonalAccessTokenScheme", JwtBearerDefaults.AuthenticationScheme)
.AddRequirements(new EmployeeStillActiveRequirement())
.Build();
});
services.AddScoped<IAuthorizationHandler, EmployeeIsActiveHandler>();
}
Expand Down

0 comments on commit 6ddc032

Please sign in to comment.