Update to latest packages and show examples
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
using Asp.Versioning;
|
||||
using GerstITS.Examples.Api.Versioning;
|
||||
using GerstITS.Validation;
|
||||
using GerstITS.Web.Api;
|
||||
using GerstITS.Web.Api.FluentApi;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace GerstITS.Examples.Api.Controllers._1._1;
|
||||
|
||||
/// <summary>
|
||||
/// Is responsible to demonstrate open id (jwt bearer) protected endpoints.
|
||||
/// </summary>
|
||||
[ApiController,
|
||||
ApiVersion(Versions._1_1),
|
||||
Authorize,
|
||||
Route(ApplicationEnvironment.WebApi.ControllerRouteTemplate)]
|
||||
public class SecuredController : FluentApiControllerBase
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
public SecuredController(IValidator validator)
|
||||
: base(validator)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the authenticated user. Requires a valid bearer token.
|
||||
/// </summary>
|
||||
/// <returns>Returns the name of the authenticated user.</returns>
|
||||
[HttpGet,
|
||||
Route("Me")]
|
||||
public IActionResult Me()
|
||||
{
|
||||
return Api().Get(() => User.Identity.Name);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
Reference in New Issue
Block a user