Authorizations
This commit is contained in:
parent
205845fac7
commit
997c39703a
13 changed files with 34 additions and 28 deletions
|
|
@ -18,7 +18,7 @@ namespace Yavsc.Controllers
|
|||
using Yavsc.Server.Helpers;
|
||||
|
||||
[Produces("application/json")]
|
||||
[Route("api/bookquery"), Authorize(Roles = "Performer,Administrator")]
|
||||
[Route("api/bookquery"), Authorize("Performer")]
|
||||
public class BookQueryApiController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ namespace Yavsc.Controllers
|
|||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[Authorize(Roles="Performer"),HttpGet("{id}")]
|
||||
[Authorize("Performer"),HttpGet("{id}")]
|
||||
public IActionResult Get(string id)
|
||||
{
|
||||
var pfr = dbContext.Performers.Include(
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ using Yavsc.Server.Helpers;
|
|||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
[Produces("application/json"),Authorize(Roles="Administrator")]
|
||||
[Produces("application/json"),Authorize("AdministratorOnly")]
|
||||
[Route("api/users")]
|
||||
public class ApplicationUserApiController : Controller
|
||||
{
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
using IdentityModel;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Yavsc;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Interface;
|
||||
using Yavsc.Models;
|
||||
|
|
@ -61,7 +62,7 @@ internal class Program
|
|||
options.IncludeErrorDetails = true;
|
||||
options.Authority = "https://localhost:5001";
|
||||
options.TokenValidationParameters =
|
||||
new() { ValidateAudience = false, RoleClaimType = JwtClaimTypes.Role };
|
||||
new() { ValidateAudience = false, RoleClaimType = Constants.RoleClaimType };
|
||||
options.MapInboundClaims = true;
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue