Authentication finally moved to the dotnet way in webapi, ready to be added to to deal with users and such
Introspection access point properly uses basic auth of client id and secret to access
This commit is contained in:
@@ -2,33 +2,30 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using WebAPI.Auth;
|
||||
using WebAPI.Data;
|
||||
|
||||
namespace WebAPI.Controllers
|
||||
{
|
||||
[Authorize(Policy = "test")]
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class HelloWorldController : BaseController
|
||||
{
|
||||
private readonly PterodactylService _pterodactylService;
|
||||
private readonly OIDCService _oidcService;
|
||||
|
||||
public HelloWorldController(PterodactylService pterodactylService, OIDCService oidcService)
|
||||
public HelloWorldController(PterodactylService pterodactylService)
|
||||
{
|
||||
_pterodactylService = pterodactylService;
|
||||
_oidcService = oidcService;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<string> HelloWorld()
|
||||
{
|
||||
if (await _oidcService.ValidateAccessToken(BearerToken))
|
||||
{
|
||||
return "Validated";
|
||||
}
|
||||
return "Failed";
|
||||
return "Success";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user