68 lines
1.7 KiB
C#
68 lines
1.7 KiB
C#
using System;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using xCommons.Attributes;
|
|
using xCommons.Constants;
|
|
using xIdentityModels.Dtos;
|
|
|
|
namespace xIds.Controllers
|
|
{
|
|
public partial class AccountController
|
|
{
|
|
//
|
|
// Implememnt all Open Actions here ...
|
|
|
|
//
|
|
#region Open Actions ...
|
|
[AllowAnonymous]
|
|
[RequireXPowered]
|
|
[HttpGet("Open")]
|
|
public async Task<ActionResult<string>> Get(
|
|
[FromHeader] string token,
|
|
[FromQuery] string request
|
|
)
|
|
{
|
|
//
|
|
// Do Action ...
|
|
try
|
|
{
|
|
//
|
|
// Validate Args ...
|
|
await ValidationProvider
|
|
.GroupValidationBuilder()
|
|
.AddNotEmpty(token)
|
|
.AddNotEmpty(request)
|
|
.ValidateGroupAsync();
|
|
|
|
//
|
|
// Prepare Inner Dto Model ...
|
|
var dto = new XOpenActionInnerDto
|
|
{
|
|
Token = token,
|
|
Payload = request
|
|
};
|
|
|
|
//
|
|
// Do Action ...
|
|
var resultDto = await IdentityManager.OpenGet(dto);
|
|
Response.Headers.Add(XAuthentication.TOKEN, resultDto.Token);
|
|
|
|
//
|
|
// Return Result
|
|
return Ok(resultDto.Payload);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
//
|
|
var result = GetExceptionActionResult(ex);
|
|
return result;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
//
|
|
#region Private ...
|
|
#endregion
|
|
}
|
|
} |