Heimdall sign-in tests: pin each refusal rule by its reason; token dates cannot overflow
The forgery and wrong-claim tests now assert which rule refused, start failures, blank attempt ids, capability shapes and date extremes are covered. A token whose exp is the largest representable date no longer overflows the clock-skew sum, and the unreachable blank-return-url fallback is removed (Program defaults it). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
650bf6bcc6
commit
1ab67da47b
4 changed files with 176 additions and 59 deletions
|
|
@ -118,7 +118,7 @@ public sealed class HeimdallAuthService(
|
|||
cancellationToken);
|
||||
return new HeimdallCompletedSignIn(
|
||||
bifrostIdentityService.BuildPrincipal(userAccount, attempt.Provider),
|
||||
string.IsNullOrWhiteSpace(attempt.ReturnUrl) ? "/App" : attempt.ReturnUrl);
|
||||
attempt.ReturnUrl);
|
||||
}
|
||||
|
||||
private async Task<UserAccount> UpsertUserAccountAsync(
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ public sealed class HeimdallTokenVerifier(
|
|||
throw Refuse("token is not yet valid");
|
||||
}
|
||||
|
||||
if (NumericDate(claims, "exp") is not { } expires || now >= expires + ClockSkew)
|
||||
if (NumericDate(claims, "exp") is not { } expires || now - ClockSkew >= expires)
|
||||
{
|
||||
throw Refuse("token has expired");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue