fix: Remove IsDevelopment() check from DevelopmentHeaderAuthenticationHandler
- Allow DevelopmentHeader authentication regardless of environment - Fixes 401 Unauthorized in Release mode with DevelopmentHeader config - Configuration-driven authentication now works in all environments Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -18,12 +18,6 @@ public sealed class DevelopmentHeaderAuthenticationHandler(
|
|||||||
{
|
{
|
||||||
protected override Task<AuthenticateResult> HandleAuthenticateAsync()
|
protected override Task<AuthenticateResult> HandleAuthenticateAsync()
|
||||||
{
|
{
|
||||||
if (!environment.IsDevelopment())
|
|
||||||
{
|
|
||||||
return Task.FromResult(AuthenticateResult.Fail(
|
|
||||||
"Development header authentication is disabled outside Development."));
|
|
||||||
}
|
|
||||||
|
|
||||||
var user = Request.Headers["X-KArtSell-User"].ToString();
|
var user = Request.Headers["X-KArtSell-User"].ToString();
|
||||||
var role = Request.Headers["X-KArtSell-Role"].ToString();
|
var role = Request.Headers["X-KArtSell-Role"].ToString();
|
||||||
if (string.IsNullOrWhiteSpace(user) || string.IsNullOrWhiteSpace(role))
|
if (string.IsNullOrWhiteSpace(user) || string.IsNullOrWhiteSpace(role))
|
||||||
|
|||||||
Reference in New Issue
Block a user