auto.bus_api/Server/Controllers/SecuredController.cs
2022-09-14 11:09:49 +03:00

20 lines
506 B
C#

using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SharedModels.Responses;
namespace Server.Controllers;
[Authorize(Roles = "Admin")]
[Route("api/secured")]
[ApiController]
public class SecuredController : ControllerBase
{
[HttpGet]
public async Task<IActionResult> GetSecuredData()
{
return Ok(new ResponseBase
{
Message = "This Secured Data is available only for Authenticated Users with Admin role."
});
}
}