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; /// /// Is responsible to demonstrate open id (jwt bearer) protected endpoints. /// [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 /// /// Gets the name of the authenticated user. Requires a valid bearer token. /// /// Returns the name of the authenticated user. [HttpGet, Route("Me")] public IActionResult Me() { return Api().Get(() => User.Identity.Name); } #endregion }