Registration gates: proof-of-work CAPTCHA and training-notice consent receipt (#54)

This commit is contained in:
Heimdall 2026-11-11 10:15:46 +00:00
commit 33be966b7d
28 changed files with 1253 additions and 56 deletions

View file

@ -21,6 +21,16 @@ public sealed class TestAuthHandler(
return Task.FromResult(AuthenticateResult.NoResult());
}
// A test may sign in as a native account by naming its Bifrost identity; only that claim is sent, so no GitHub claim also matches.
if (Request.Headers.TryGetValue("X-Test-Bifrost-Identity", out var nativeIdentity))
{
var native = new ClaimsIdentity(
[new Claim(BifrostClaimTypes.BifrostIdentity, nativeIdentity.ToString())],
SchemeName);
return Task.FromResult(AuthenticateResult.Success(
new AuthenticationTicket(new ClaimsPrincipal(native), SchemeName)));
}
// A test may sign in as another account by naming its GitHub id and login.
var gitHubId = Request.Headers["X-Test-GitHub-Id"].FirstOrDefault() ?? "12345";
var login = Request.Headers["X-Test-GitHub-Login"].FirstOrDefault() ?? "test-admin";