mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-19 18:11:36 +01:00
Rewrite the BitpayAuthHandler more clearly
This commit is contained in:
parent
873c0a183a
commit
4d7e9d3f8a
@ -71,24 +71,22 @@ namespace BTCPayServer.Security
|
|||||||
success = storeId != null;
|
success = storeId != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success.HasValue)
|
if (success is true)
|
||||||
{
|
{
|
||||||
if (success.Value)
|
if (storeId != null)
|
||||||
{
|
{
|
||||||
if (storeId != null)
|
claims.Add(new Claim(Policies.CanCreateInvoice.Key, storeId));
|
||||||
{
|
var store = await _StoreRepository.FindStore(storeId);
|
||||||
claims.Add(new Claim(Policies.CanCreateInvoice.Key, storeId));
|
store.AdditionalClaims.AddRange(claims);
|
||||||
var store = await _StoreRepository.FindStore(storeId);
|
Context.Request.HttpContext.SetStoreData(store);
|
||||||
store.AdditionalClaims.AddRange(claims);
|
|
||||||
Context.Request.HttpContext.SetStoreData(store);
|
|
||||||
}
|
|
||||||
return AuthenticateResult.Success(new AuthenticationTicket(new ClaimsPrincipal(new ClaimsIdentity(claims, Policies.BitpayAuthentication)), Policies.BitpayAuthentication));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return AuthenticateResult.Fail("Invalid credentials");
|
|
||||||
}
|
}
|
||||||
|
return AuthenticateResult.Success(new AuthenticationTicket(new ClaimsPrincipal(new ClaimsIdentity(claims, Policies.BitpayAuthentication)), Policies.BitpayAuthentication));
|
||||||
}
|
}
|
||||||
|
else if (success is false)
|
||||||
|
{
|
||||||
|
return AuthenticateResult.Fail("Invalid credentials");
|
||||||
|
}
|
||||||
|
// else if (success is null)
|
||||||
}
|
}
|
||||||
return AuthenticateResult.NoResult();
|
return AuthenticateResult.NoResult();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user