features/role-updates #18

Merged
jtom38 merged 8 commits from features/role-updates into main 2023-08-06 13:39:48 -07:00
2 changed files with 5 additions and 3 deletions
Showing only changes of commit bd05c45e6e - Show all commits

View File

@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Newsbot.Collector.Api.Domain; using Newsbot.Collector.Api.Domain.Consts;
using Newsbot.Collector.Database; using Newsbot.Collector.Database;
using Newsbot.Collector.Database.Repositories; using Newsbot.Collector.Database.Repositories;
using Newsbot.Collector.Domain.Interfaces; using Newsbot.Collector.Domain.Interfaces;

View File

@ -1,7 +1,7 @@
using System.Text; using System.Text;
using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.IdentityModel.Tokens; using Microsoft.IdentityModel.Tokens;
using Newsbot.Collector.Api.Domain; using Newsbot.Collector.Api.Domain.Consts;
using Newsbot.Collector.Domain.Models.Config; using Newsbot.Collector.Domain.Models.Config;
namespace Newsbot.Collector.Api.Startup; namespace Newsbot.Collector.Api.Startup;
@ -44,7 +44,9 @@ public static class IdentityStartup
services.AddAuthorization(options => services.AddAuthorization(options =>
{ {
options.AddPolicy(Authorization.AdministratorPolicy, options.AddPolicy(Authorization.AdministratorPolicy,
b => b.RequireClaim(Authorization.AdministratorClaim, "true")); b => b.RequireRole(Authorization.AdministratorsRole, "true"));
options.AddPolicy(Authorization.UserPolicy,
b => b.RequireRole(Authorization.UsersRole, "true"));
}); });
} }
} }