You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

42 lines
1.1 KiB

using Tiobon.Core.Common.HttpContextUser;
using Tiobon.Core.Model;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Linq;
namespace Tiobon.Core.Gateway.Controllers
{
[Authorize(AuthenticationSchemes = Permissions.GWName)]
[Route("/gateway/[controller]/[action]")]
public class UserController : ControllerBase
{
private readonly IUser _user;
public UserController(IUser user)
{
_user = user;
}
[HttpGet]
public ServiceResult<List<ClaimDto>> MyClaims()
{
return new ServiceResult<List<ClaimDto>>()
{
Success = true,
Data = (_user.GetClaimsIdentity().ToList()).Select(d =>
new ClaimDto
{
Type = d.Type,
Value = d.Value
}
).ToList()
};
}
}
public class ClaimDto
{
public string Type { get; set; }
public string Value { get; set; }
}
}