everything works now
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-05-19 23:14:57 +02:00
parent 0b01340e88
commit beab15a7ef
10 changed files with 168 additions and 32 deletions

View File

@ -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()