This commit is contained in:
@ -2,8 +2,8 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Net.Mime;
|
||||
using System.Security.Claims;
|
||||
|
||||
@ -34,10 +34,10 @@ namespace HanyadikHetVan.Controllers.V1
|
||||
[Produces(MediaTypeNames.Application.Json)]
|
||||
public string Protected()
|
||||
{
|
||||
return this.User.FindFirst(ClaimTypes.Role).Value;
|
||||
return this.User.FindFirst("user_role").Value;
|
||||
}
|
||||
|
||||
[Authorize(Roles = "admin")]
|
||||
[Authorize(Policy = "AdminPolicy", AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
|
||||
[HttpGet("roleprotected")]
|
||||
[Produces(MediaTypeNames.Application.Json)]
|
||||
public string RoleProtected()
|
||||
|
Reference in New Issue
Block a user