-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
Copy pathUserController.cs
42 lines (39 loc) · 1.09 KB
/
UserController.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using Blog.Core.Common.HttpContextUser;
using Blog.Core.Model;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Linq;
namespace Blog.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 MessageModel<List<ClaimDto>> MyClaims()
{
return new MessageModel<List<ClaimDto>>()
{
success = true,
response = (_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; }
}
}