fix: require auth to setup provider
This commit is contained in:
parent
a366328472
commit
983e357a01
1 changed files with 1 additions and 8 deletions
|
|
@ -67,7 +67,7 @@ public class AuthController(Authentication authentication, Settings settings) :
|
||||||
return Ok();
|
return Ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
[AllowAnonymous]
|
[Authorize(Policy = "AuthSetting")]
|
||||||
[Route("SetupProvider")]
|
[Route("SetupProvider")]
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<ActionResult> SetupProvider([FromBody] AuthControllerSetupProviderRequest? request)
|
public async Task<ActionResult> SetupProvider([FromBody] AuthControllerSetupProviderRequest? request)
|
||||||
|
|
@ -82,13 +82,6 @@ public class AuthController(Authentication authentication, Settings settings) :
|
||||||
return StatusCode(401);
|
return StatusCode(401);
|
||||||
}
|
}
|
||||||
|
|
||||||
var user = await authentication.GetUser();
|
|
||||||
|
|
||||||
if (user != null)
|
|
||||||
{
|
|
||||||
return StatusCode(401);
|
|
||||||
}
|
|
||||||
|
|
||||||
await settings.Update("Provider:Provider", request.Provider);
|
await settings.Update("Provider:Provider", request.Provider);
|
||||||
await settings.Update("Provider:ApiKey", request.Token);
|
await settings.Update("Provider:ApiKey", request.Token);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue