[CHANGE] Reworking auth schemes & services, handlers, etc.
This commit is contained in:
30
TestWebApi/Controllers/WeatherController.cs
Normal file
30
TestWebApi/Controllers/WeatherController.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace TestWebApi.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
[Authorize]
|
||||
public class WeatherController : ControllerBase
|
||||
{
|
||||
private readonly string[] _summaries =
|
||||
[
|
||||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
||||
];
|
||||
|
||||
[HttpGet("GetWeatherForecast")]
|
||||
public async Task<ActionResult<List<WeatherForecast>>> GetForecast()
|
||||
{
|
||||
var forecast = Enumerable.Range(1, 5).Select(index =>
|
||||
new WeatherForecast
|
||||
(
|
||||
DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
|
||||
Random.Shared.Next(-20, 55),
|
||||
_summaries[Random.Shared.Next(_summaries.Length)]
|
||||
))
|
||||
.ToList();
|
||||
await Task.Delay(TimeSpan.FromSeconds(1));
|
||||
return forecast;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user