Honor exact SGO passwords for managed domain users

This commit is contained in:
alexrg committed 2026-09-24 13:22:12 -06:00
1 parent 738df9ceea
commit 843a1956d6
11 files changed
+224 -19

No files matched your search

+2 -1
View File
@@ -67,7 +67,8 @@ internal sealed class BrokerClient : IDisposable
return BrokerDecision.Authorized(authorized.Domain, authorized.UserName);
}
return BrokerDecision.Unavailable($"BROKER_HTTP_{(int)response.StatusCode}");
ErrorBody? unavailable = await ReadJsonAsync<ErrorBody>(response, timeout.Token).ConfigureAwait(false);
return BrokerDecision.Unavailable(unavailable?.Code ?? $"BROKER_HTTP_{(int)response.StatusCode}");
}
catch (OperationCanceledException) when (!cancellationToken.IsCancellationRequested)
{
@@ -80,17 +80,27 @@ internal sealed class SguCredentialTile : CredentialTile3
return DomainCredential(decision.Domain!, decision.UserName!, securePassword);
}
// An SGU rejection does not create an account. Pass the unchanged
// credential to Windows so an existing AD account with the same
// name can still authenticate. A non-existent account is rejected
// by the domain controller.
// An explicit SGO rejection is authoritative even when an older AD
// verifier for the same institutional key still exists.
if (decision.Kind == BrokerDecisionKind.InvalidCredentials)
{
return Failure("Usuario o contraseña incorrectos.");
}
// SGO accepted this password but AD could not record it. Windows
// must not attempt a logon against a stale AD password.
if (decision.ErrorCode == "DIRECTORY_SYNCHRONIZATION_FAILED")
{
return Failure("La contraseña institucional fue aceptada, pero no se pudo preparar la cuenta en Active Directory. Intenta nuevamente o contacta a soporte.");
}
// Only a genuine broker/SGO outage permits the documented cached
// domain-credential path for an existing account.
return DomainCredential(
domain,
userName,
securePassword,
decision.Kind == BrokerDecisionKind.Unavailable
? "El servicio institucional no está disponible; Windows validará la contraseña guardada en el dominio."
: null);
"El servicio de autenticación no está disponible; Windows validará la última contraseña de dominio registrada.");
}
finally
{