Added oidc service to webapi with a dumb way of authenticating incoming tokens
This commit is contained in:
@@ -10,20 +10,26 @@ namespace WebAPI.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class HelloWorldController : ControllerBase
|
||||
public class HelloWorldController : BaseController
|
||||
{
|
||||
private readonly PterodactylService _pterodactylService;
|
||||
private readonly OIDCService _oidcService;
|
||||
|
||||
public HelloWorldController(PterodactylService pterodactylService)
|
||||
public HelloWorldController(PterodactylService pterodactylService, OIDCService oidcService)
|
||||
{
|
||||
_pterodactylService = pterodactylService;
|
||||
_oidcService = oidcService;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<string> HelloWorld()
|
||||
{
|
||||
await Task.Delay(5000);
|
||||
return AppSettings.PterodactylAPIKey;
|
||||
if (await _oidcService.ValidateAccessToken(BearerToken))
|
||||
{
|
||||
return "Validated";
|
||||
}
|
||||
return "Failed";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user