23 lines
670 B
C#
Executable File
23 lines
670 B
C#
Executable File
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
namespace Commerce.Config;
|
|
public static class Authorization
|
|
{
|
|
public static IServiceCollection Authorize(this IServiceCollection services)
|
|
{
|
|
services.AddAuthorization(options =>
|
|
{
|
|
options.AddPolicy("Admin", policy => policy.RequireRole("ADMIN"));
|
|
options.AddPolicy("Moderator", policy => policy.RequireRole("Moderator"));
|
|
options.AddPolicy("Seller", policy => policy.RequireRole("Seller"));
|
|
});
|
|
|
|
return services;
|
|
|
|
}
|
|
}
|