27 lines
665 B
C#
27 lines
665 B
C#
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace KTUSA_PS.Controllers
|
|
{
|
|
[Route("[controller]")]
|
|
[Authorize]
|
|
[ApiController]
|
|
public class TestController : ControllerBase
|
|
{
|
|
[HttpGet]
|
|
public object[] Index()
|
|
{
|
|
return HttpContext.User.Claims.Select(x => new { Name = x.Type, Value= x.Value }).ToArray();
|
|
}
|
|
|
|
[HttpGet("authed")]
|
|
public bool IsAuthed() => true;
|
|
}
|
|
}
|