This commit is contained in:
@ -22,7 +22,6 @@ namespace HanyadikHetVan.Controllers.V1
|
||||
}
|
||||
|
||||
[HttpGet("json")]
|
||||
[Consumes(MediaTypeNames.Application.Json)]
|
||||
[Produces(MediaTypeNames.Application.Json)]
|
||||
public HanyadikHetVanDTO GetJson()
|
||||
{
|
||||
|
@ -2,6 +2,7 @@
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Net.Mime;
|
||||
using System.Security.Claims;
|
||||
|
||||
namespace HanyadikHetVan.Controllers.V1
|
||||
@ -19,7 +20,7 @@ namespace HanyadikHetVan.Controllers.V1
|
||||
}
|
||||
|
||||
[HttpGet("unprotected")]
|
||||
[Produces("application/json")]
|
||||
[Produces(MediaTypeNames.Application.Json)]
|
||||
public string Unprotected()
|
||||
{
|
||||
|
||||
@ -28,10 +29,18 @@ namespace HanyadikHetVan.Controllers.V1
|
||||
|
||||
[Authorize]
|
||||
[HttpGet("protected")]
|
||||
[Produces("application/json")]
|
||||
[Produces(MediaTypeNames.Application.Json)]
|
||||
public string Protected()
|
||||
{
|
||||
return this.User.FindFirst(ClaimTypes.NameIdentifier).Value;
|
||||
}
|
||||
|
||||
[Authorize(Roles = "admin")]
|
||||
[HttpGet("roleprotected")]
|
||||
[Produces(MediaTypeNames.Application.Json)]
|
||||
public string RoleProtected()
|
||||
{
|
||||
return this.User.FindFirst(ClaimTypes.NameIdentifier).Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user