Logout reconciler: one subject's unexpected exception does not stop the pass
Caught per subject, logged at error with the subject id and exception type only, authorizations left valid; cancellation still stops the pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
ec66fba5ca
commit
8340ee0e92
1 changed files with 16 additions and 2 deletions
|
|
@ -15,7 +15,8 @@ namespace Bifrost.Web.Features.Oidc;
|
||||||
/// authorizations of the configured client; for each one the shared active-member reading refuses, it POSTs one signed
|
/// authorizations of the configured client; for each one the shared active-member reading refuses, it POSTs one signed
|
||||||
/// OIDC back-channel logout token to MAS and, only after a 2xx, revokes that subject's authorizations. The
|
/// OIDC back-channel logout token to MAS and, only after a 2xx, revokes that subject's authorizations. The
|
||||||
/// authorizations table is the queue: nothing is stored, so a restart, a MAS outage or a later-set URI resumes from it.
|
/// authorizations table is the queue: nothing is stored, so a restart, a MAS outage or a later-set URI resumes from it.
|
||||||
/// Per-subject backoff lives in memory only. It never writes membership.
|
/// Per-subject backoff lives in memory only. One subject's unexpected exception is logged and skipped, never aborting the
|
||||||
|
/// pass. It never writes membership.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class OidcLogoutReconciler(
|
public sealed class OidcLogoutReconciler(
|
||||||
IServiceScopeFactory scopeFactory,
|
IServiceScopeFactory scopeFactory,
|
||||||
|
|
@ -80,7 +81,20 @@ public sealed class OidcLogoutReconciler(
|
||||||
foreach (var subject in subjects)
|
foreach (var subject in subjects)
|
||||||
{
|
{
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
await ReconcileSubjectAsync(subject, cancellationToken);
|
try
|
||||||
|
{
|
||||||
|
await ReconcileSubjectAsync(subject, cancellationToken);
|
||||||
|
}
|
||||||
|
catch (OperationCanceledException) when (cancellationToken.IsCancellationRequested)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception error)
|
||||||
|
{
|
||||||
|
// One subject's fault never stops the pass: its authorizations stay valid and the next tick retries it.
|
||||||
|
// The subject id and the exception type only: messages can carry connection strings or URLs.
|
||||||
|
logger.LogError("Back-channel logout for subject {Subject} failed: {ErrorType}", subject, error.GetType().Name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue