[WIP]
This commit is contained in:
@@ -1,33 +1,33 @@
|
||||
using System.Security.Claims;
|
||||
using System.Text.Json;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace DotBased.AspNet.Authority.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Microsoft.AspNetCore.Mvc.Route("[controller]")]
|
||||
[Route("[controller]")]
|
||||
public class AuthorityController : ControllerBase
|
||||
{
|
||||
[Inject]
|
||||
public IAuthenticationService AuthenticationService { get; set; }
|
||||
|
||||
[HttpGet("auth/login")]
|
||||
[AllowAnonymous]
|
||||
public async Task<ActionResult> LoginFromSchemeAsync([FromQuery(Name = "s")] string? scheme)
|
||||
{
|
||||
var authResult = await HttpContext.AuthenticateAsync();
|
||||
var cPrincipal = new ClaimsPrincipal();
|
||||
await HttpContext.SignInAsync(cPrincipal);
|
||||
return Ok();
|
||||
}
|
||||
|
||||
[HttpGet("auth/logout")]
|
||||
public async Task<ActionResult> LogoutAsync()
|
||||
{
|
||||
await HttpContext.SignOutAsync();
|
||||
return Ok();
|
||||
}
|
||||
|
||||
[HttpGet("info")]
|
||||
[AllowAnonymous]
|
||||
public async Task<ActionResult<JsonDocument>> GetAuthorityInfoAsync()
|
||||
{
|
||||
return Ok();
|
||||
|
Reference in New Issue
Block a user