Linked accounts: drop the list after an unlink with an uncertain end; Google never mints; docs
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
8e65f56b0c
commit
18f1ec6aca
5 changed files with 102 additions and 22 deletions
|
|
@ -164,7 +164,7 @@ public sealed class HeimdallAuthService(
|
|||
|
||||
/// <summary>
|
||||
/// The provider an ordinary proof sign-in uses, or null when none is safe. A sign-in through a provider the account no
|
||||
/// longer holds makes Heimdall mint an unrelated account that holds that login, so it is never guessed: with the account's
|
||||
/// longer holds makes Heimdall mint an unrelated account that holds that login (Discord and Patreon; Google refuses instead), so it is never guessed: with the account's
|
||||
/// current list, the first held one of the person's choice, Discord, Patreon, Google; with no list, only a provider the
|
||||
/// member named (<paramref name="via"/>), who is the one who knows what they hold. The session's provider claim is not
|
||||
/// consulted: it records how they signed in once, not what the account holds now.
|
||||
|
|
@ -473,14 +473,15 @@ public sealed class HeimdallAuthService(
|
|||
}
|
||||
|
||||
var unlinked = await memberClient.UnlinkAsync(bearer, attempt.Target ?? string.Empty, cancellationToken);
|
||||
switch (unlinked.Call)
|
||||
// Only Heimdall's definitive refusals leave the account as the list showed it. Any other end (not found, a lost
|
||||
// answer, a 500, a malformed 200) may have applied the unlink, so the list is dropped rather than trusted.
|
||||
if (unlinked.Call == HeimdallMemberCall.Ok)
|
||||
{
|
||||
case HeimdallMemberCall.Ok:
|
||||
snapshots.Put(identity.AccountId, unlinked.Identities!);
|
||||
break;
|
||||
case HeimdallMemberCall.IdentityNotFound:
|
||||
snapshots.Remove(identity.AccountId);
|
||||
break;
|
||||
snapshots.Put(identity.AccountId, unlinked.Identities!);
|
||||
}
|
||||
else if (unlinked.Call is not (HeimdallMemberCall.SignInRequired or HeimdallMemberCall.StepUpRequired or HeimdallMemberCall.LastIdentity))
|
||||
{
|
||||
snapshots.Remove(identity.AccountId);
|
||||
}
|
||||
|
||||
return new HeimdallLinkStep(null, cookieName, null, unlinked.Call == HeimdallMemberCall.Ok ? HeimdallLinkOutcome.Unlinked : OutcomeOf(unlinked.Call));
|
||||
|
|
|
|||
|
|
@ -32,15 +32,16 @@
|
|||
<p class="muted">
|
||||
Bifrost does not hold the list: it asks Heimdall, which means signing in to Heimdall again, and keeps the answer for
|
||||
five minutes. It also cannot tell which logins this account holds right now, so it will not choose one for you.
|
||||
Pick a login you know it holds. Signing in through one it no longer holds would create a separate Heimdall account
|
||||
holding that login.
|
||||
Pick a login you know it holds. Signing in through Discord or Patreon when the account no longer holds that login
|
||||
would create a separate Heimdall account holding it. Google cannot do that: Heimdall refuses a Google sign-in for a
|
||||
login no account holds.
|
||||
</p>
|
||||
<div class="panel-actions">
|
||||
@foreach (var provider in Model.LinkableProviders)
|
||||
@foreach (var provider in Model.LinkableProviders.OrderBy(x => x == "google" ? 0 : 1))
|
||||
{
|
||||
<form method="post" asp-page-handler="Refresh" class="inline-actions">
|
||||
<input type="hidden" name="via" value="@provider" />
|
||||
<button class="button secondary" type="submit">Show my logins through @LinkedAccountsModel.ProviderName(provider)</button>
|
||||
<button class="button secondary" type="submit">Show my logins through @LinkedAccountsModel.ProviderName(provider)@(provider == "google" ? " (cannot create an account)" : "")</button>
|
||||
</form>
|
||||
}
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in a new issue