diff --git a/README.md b/README.md index fa2da51..88eddd8 100644 --- a/README.md +++ b/README.md @@ -13,20 +13,25 @@ Ready-to-run bootstrap packages are published on the ## Authentication contract -1. The Windows tile collects a `DO`, `AL`, or `AD` institutional key and a password. -2. It sends that exact password over mutually authenticated TLS to the broker. -3. The broker validates the same key/password pair against the lightweight SGU - NTLM root. Only an authoritative `401`/`403` rejects the credential. -4. After successful authentication, the broker makes a separately bounded, - best-effort request for the minimum available SGU profile fields. -5. On success, the broker creates or moves the AD user, updates the available - name/mail/title/department/address metadata when available, and sets the AD password - to the exact submitted password. -6. The Credential Provider serializes the original `SecureString` to Windows. +1. Windows presents one **La Salle** sign-in tile with `Usuario` and `Contraseña`. +2. The user enters a `DO`, `AL`, or `AD` key and the current password once. +3. The tile sends that exact pair over mutually authenticated TLS to the broker, + which validates it against the institutional authority. Only an authoritative + `401`/`403` rejects it. +4. On every valid sign-in, the broker performs an idempotent Active Directory + UPSERT: it creates or repairs the account, its role OU and group, supported + profile fields, and the AD password using the password just validated. +5. The Credential Provider serializes the original `SecureString` to Windows. No derived password is created. Passwords are not written to a database, file, event log, application log, command line, or response. +This makes Active Directory the only Windows sign-in account while preserving +automatic synchronization: if a person changes their institutional password, +the next successful La Salle sign-in updates the domain password before Windows +continues. A matching prefix alone never creates an account; the institutional +authority must first accept the submitted password. + For administrative accounts, profile enrichment first verifies the employee number against the incident overview, then reads the structured given names and surnames from `datos/personales.aspx` and the postal address from diff --git a/docs/architecture.md b/docs/architecture.md index 0d65d8e..98ebf14 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -57,10 +57,17 @@ an error and does not serialize the rejected credential. ## Account synchronization -The broker normalizes the username to uppercase and accepts exactly two letters -plus six digits. It searches `BaseDn` by `sAMAccountName`, creates the user when -absent, moves it to the mapped OU when required, sets `userPrincipalName`, and -passes the submitted password directly to ADSI `SetPassword`. +The visible Windows experience is a single **La Salle** sign-in tile with +`Usuario` and `Contraseña`; the institutional authority is not a separate tile +or second password prompt. The broker normalizes the username to uppercase and +accepts exactly two letters plus six digits. After the authority accepts the +submitted password, it searches `BaseDn` by `sAMAccountName`, creates the user +when absent, moves it to the mapped OU when required, sets `userPrincipalName`, +and passes that same submitted password directly to ADSI `SetPassword`. This is +an idempotent UPSERT performed on every successful sign-in, so the next sign-in +after an institutional password change updates AD before Windows validates the +interactive logon. A matching username pattern alone never provisions an +account. Before an account becomes usable, the broker applies explicit deny ACEs for the Active Directory `Change Password` extended right to SELF and Everyone. Users @@ -125,9 +132,9 @@ Windows client maps the group into its local **Remote Desktop Users** group. Every synchronized user also receives `La Salle` in the AD `company` attribute unless deployment configuration supplies another default. -The generic SGU credential is rendered as a dedicated branded tile instead of +The generic La Salle credential is rendered as a dedicated branded tile instead of being grouped below the anonymous **Other user** tile. Machine policy assigns -the SGU CLSID as the default provider, hides the last signed-in identity, and +the provider CLSID as the default provider, hides the last signed-in identity, and disables local-user enumeration while retaining the built-in Microsoft password provider and its **Other user** recovery path. The computer GPO also applies Windows' native default account picture to named Windows accounts; client diff --git a/docs/client-enrollment.md b/docs/client-enrollment.md index eb01b69..38b54b3 100644 --- a/docs/client-enrollment.md +++ b/docs/client-enrollment.md @@ -232,8 +232,10 @@ administradores. El proveedor usa un mosaico genérico dedicado, no una credencial asociada al SID anónimo de **Other user**. Windows muestra la imagen institucional y la etiqueta -`La Salle · Acceso SGU`; el encabezado `Acceso institucional SGU` -se publica como `CPFT_LARGE_TEXT` solamente en el mosaico seleccionado. LogonUI +`La Salle`; el encabezado `Iniciar sesión` se publica como `CPFT_LARGE_TEXT` +solamente en el mosaico seleccionado. El usuario captura una sola vez `Usuario` +y `Contraseña`; la sincronización institucional y el UPSERT de Active Directory +ocurren detrás de esa misma pantalla. LogonUI elige la familia, el peso y el tamaño final y no expone opciones de tipografía a un Credential Provider. diff --git a/docs/lab-runbook.md b/docs/lab-runbook.md index da38346..2358283 100644 --- a/docs/lab-runbook.md +++ b/docs/lab-runbook.md @@ -136,7 +136,7 @@ On Windows 10: ``` Use Lithnet's `Invoke-CredUI` test utility when available, or sign out/restart -the VM and select **Acceso institucional SGU**. Keep the built-in Windows +the VM and select **La Salle**. Keep the built-in Windows password provider available through **Other user**. On the domain controller, apply the SGU user and computer policies once: diff --git a/docs/release-0.6.13.md b/docs/release-0.6.13.md new file mode 100644 index 0000000..1d2bfb8 --- /dev/null +++ b/docs/release-0.6.13.md @@ -0,0 +1,15 @@ +# SGU Credential Provider 0.6.13 + +La pantalla de inicio de sesión ahora presenta una sola credencial visible: +**La Salle**, con los campos `Usuario` y `Contraseña`. Ya no muestra el texto +“Acceso Institucional SGU”. + +La autenticación institucional permanece dentro del broker, sin una segunda +captura. Después de cada autenticación válida, el broker ejecuta su UPSERT de +Active Directory: crea o repara la cuenta, la OU, el grupo, los datos de perfil +disponibles y la contraseña de AD. Así, la siguiente sesión después de cambiar +una contraseña institucional sincroniza esa contraseña con el dominio. + +El patrón `DO`, `AL` o `AD` con seis dígitos continúa siendo sólo un formato de +usuario. No autoriza ni crea cuentas por sí mismo: la autoridad institucional +debe validar la contraseña antes de que el UPSERT haga cambios en AD. diff --git a/docs/windows-client-onboarding.md b/docs/windows-client-onboarding.md index b432b05..1229f21 100644 --- a/docs/windows-client-onboarding.md +++ b/docs/windows-client-onboarding.md @@ -97,7 +97,7 @@ usuario que cerró sesión y deshabilita la enumeración de usuarios locales en equipo unido al dominio. No modifica ni oculta el proveedor de contraseña de Microsoft; **Other user** permanece como ruta de recuperación. -Cerrar sesión o reiniciar el equipo. El acceso SGU debe quedar seleccionado por +Cerrar sesión o reiniciar el equipo. El acceso La Salle debe quedar seleccionado por defecto y el proveedor de contraseña de Microsoft debe permanecer disponible. ## 5. Verificación diff --git a/scripts/Install-CredentialProvider.ps1 b/scripts/Install-CredentialProvider.ps1 index 0c691ae..7e22ec8 100644 --- a/scripts/Install-CredentialProvider.ps1 +++ b/scripts/Install-CredentialProvider.ps1 @@ -303,7 +303,7 @@ if ($PSCmdlet.ShouldProcess($installPath, 'Install and register the SGU Credenti # Windows PowerShell 5.1 interprets an UTF-8 script without a BOM using the # current ANSI code page. Construct the middle dot from its Unicode value so # the LogonUI registry label remains correct on every client locale. - Set-Item -Path $providerRegistryPath -Value ('La Salle {0} Acceso SGU' -f [char]0x00B7) + Set-Item -Path $providerRegistryPath -Value 'La Salle' if (-not $DoNotSetAsDefaultCredentialProvider) { if (-not (Test-Path -LiteralPath $defaultProviderPolicyPath)) { @@ -316,7 +316,7 @@ if ($PSCmdlet.ShouldProcess($installPath, 'Install and register the SGU Credenti -Force | Out-Null } - # Do not leave a signed-out SGU identity exposed as a persistent user tile. + # Do not leave a signed-out domain identity exposed as a persistent user tile. # The Microsoft password provider remains registered and supplies Other user. if (-not (Test-Path -LiteralPath $interactiveLogonPolicyPath)) { New-Item -Path $interactiveLogonPolicyPath -Force | Out-Null diff --git a/src/SGU.AuthBroker/Program.cs b/src/SGU.AuthBroker/Program.cs index cd4b9f4..d8dd90c 100644 --- a/src/SGU.AuthBroker/Program.cs +++ b/src/SGU.AuthBroker/Program.cs @@ -161,7 +161,7 @@ app.MapPost("/v1/authenticate", async ( AuthenticationFlowOutcome.InvalidCredentials => Results.Json( new ErrorResponse( result.ErrorCode ?? "INVALID_INSTITUTIONAL_CREDENTIALS", - "Credenciales institucionales inválidas."), + "Usuario o contraseña incorrectos."), statusCode: StatusCodes.Status401Unauthorized), _ => Unavailable(context, result.ErrorCode) diff --git a/src/SGU.CredentialProvider/SguCredentialProvider.cs b/src/SGU.CredentialProvider/SguCredentialProvider.cs index 4da1cdf..9e4f907 100644 --- a/src/SGU.CredentialProvider/SguCredentialProvider.cs +++ b/src/SGU.CredentialProvider/SguCredentialProvider.cs @@ -16,12 +16,12 @@ public sealed class SguCredentialProvider : CredentialProviderBase { yield return new CredentialProviderLabelControl( ControlKeys.ProviderLabel, - "La Salle · Acceso SGU"); + "La Salle"); yield return new CredentialProviderLogoControl( ControlKeys.ProviderLogo, - "Acceso institucional SGU", + "Inicio de sesión La Salle", ProviderTileIcon.Create()); - yield return new LargeLabelControl(ControlKeys.Heading, "Acceso institucional SGU") + yield return new LargeLabelControl(ControlKeys.Heading, "Iniciar sesión") { // Isolate the CPFT_LARGE_TEXT heading from the compact provider tile // for the selected-layout variant. LogonUI still owns the typography. @@ -29,8 +29,8 @@ public sealed class SguCredentialProvider : CredentialProviderBase }; yield return new SmallLabelControl( ControlKeys.InformationLabel, - "Usa tu clave institucional (DO, AL o AD + 6 dígitos) y contraseña."); - yield return new TextboxControl(ControlKeys.UserName, "Clave institucional"); + "Escribe tu usuario y contraseña."); + yield return new TextboxControl(ControlKeys.UserName, "Usuario"); SecurePasswordTextboxControl password = new(ControlKeys.Password, "Contraseña"); yield return password; yield return new SubmitButtonControl(ControlKeys.Submit, "Iniciar sesión", password); diff --git a/src/SGU.CredentialProvider/SguCredentialTile.cs b/src/SGU.CredentialProvider/SguCredentialTile.cs index 77e6d0b..00194ad 100644 --- a/src/SGU.CredentialProvider/SguCredentialTile.cs +++ b/src/SGU.CredentialProvider/SguCredentialTile.cs @@ -36,7 +36,7 @@ internal sealed class SguCredentialTile : CredentialTile3 { if (!UserIdentityClassifier.TryParse(userNameControl.Text, out UserIdentity? identity) || identity is null) { - return Failure("La clave debe usar DO, AL o AD seguido de seis dígitos."); + return Failure("El usuario debe usar DO, AL o AD seguido de seis dígitos."); } SecureString securePassword = passwordControl.Password; @@ -67,7 +67,7 @@ internal sealed class SguCredentialTile : CredentialTile3 if (decision.Kind == BrokerDecisionKind.InvalidCredentials) { - return Failure("Credenciales institucionales inválidas."); + return Failure("Usuario o contraseña incorrectos."); } string domain = decision.Kind == BrokerDecisionKind.Authorized @@ -82,7 +82,7 @@ internal sealed class SguCredentialTile : CredentialTile3 IsSuccess = true, StatusIcon = decision.Kind == BrokerDecisionKind.Unavailable ? StatusIcon.Warning : StatusIcon.None, StatusText = decision.Kind == BrokerDecisionKind.Unavailable - ? "Servicio institucional no disponible; Windows validará la última contraseña de dominio registrada." + ? "El servicio de autenticación no está disponible; Windows validará la última contraseña de dominio registrada." : null, Domain = domain, Username = userName, diff --git a/tests/SGU.AuthBroker.Core.Tests/AuthenticationWorkflowTests.cs b/tests/SGU.AuthBroker.Core.Tests/AuthenticationWorkflowTests.cs index 29c6e80..cda328f 100644 --- a/tests/SGU.AuthBroker.Core.Tests/AuthenticationWorkflowTests.cs +++ b/tests/SGU.AuthBroker.Core.Tests/AuthenticationWorkflowTests.cs @@ -69,6 +69,29 @@ public sealed class AuthenticationWorkflowTests Assert.Null(directory.Password); } + [Fact] + public async Task EverySuccessfulSignInSynchronizesTheLatestPassword() + { + CapturingDirectorySynchronizer directory = new(); + AuthenticationWorkflow workflow = new( + new CapturingNtlmValidator(NtlmValidationResult.Valid()), + directory); + + _ = await workflow.AuthenticateAsync( + "AL123456", + "Contraseña-anterior-27!", + TestContext.Current.CancellationToken); + AuthenticationFlowResult result = await workflow.AuthenticateAsync( + "AL123456", + "Contraseña-nueva-28!", + TestContext.Current.CancellationToken); + + Assert.Equal(AuthenticationFlowOutcome.Authorized, result.Outcome); + Assert.Equal( + ["Contraseña-anterior-27!", "Contraseña-nueva-28!"], + directory.Passwords); + } + private sealed class CapturingNtlmValidator(NtlmValidationResult result) : INtlmCredentialValidator { public UserIdentity? Identity { get; private set; } @@ -92,6 +115,8 @@ public sealed class AuthenticationWorkflowTests public string? Password { get; private set; } + public List Passwords { get; } = []; + public InstitutionalProfile? Profile { get; private set; } public Task SynchronizeAsync( @@ -103,6 +128,7 @@ public sealed class AuthenticationWorkflowTests Identity = identity; Profile = profile; Password = password; + Passwords.Add(password); return Task.FromResult(new DirectorySyncResult( "LCI", identity.UserName, diff --git a/tests/SGU.CredentialProvider.SmokeProbe/Program.cs b/tests/SGU.CredentialProvider.SmokeProbe/Program.cs index 21242c0..292387e 100644 --- a/tests/SGU.CredentialProvider.SmokeProbe/Program.cs +++ b/tests/SGU.CredentialProvider.SmokeProbe/Program.cs @@ -14,11 +14,11 @@ internal static class Program private static readonly string[] ExpectedLabels = [ - "La Salle · Acceso SGU", - "Acceso institucional SGU", - "Acceso institucional SGU", - "Usa tu clave institucional (DO, AL o AD + 6 dígitos) y contraseña.", - "Clave institucional", + "La Salle", + "Inicio de sesión La Salle", + "Iniciar sesión", + "Escribe tu usuario y contraseña.", + "Usuario", "Contraseña", "Iniciar sesión" ]; @@ -146,7 +146,7 @@ internal static class Program private static int RunSerializationProbe(string mode, IntPtr credential, IReadOnlyList labels) { string[] labelArray = labels.ToArray(); - uint userNameFieldId = checked((uint)Array.IndexOf(labelArray, "Clave institucional")); + uint userNameFieldId = checked((uint)Array.IndexOf(labelArray, "Usuario")); uint passwordFieldId = checked((uint)Array.IndexOf(labelArray, "Contraseña")); string userName = mode == "online-success" ? Environment.GetEnvironmentVariable("SGU_TEST_USERNAME") @@ -184,7 +184,7 @@ internal static class Program bool rejectionPassed = response == (int)SerializationResponse.NoCredentialNotFinished && serialization.SerializationData == IntPtr.Zero && statusIcon == (int)StatusIcon.Error && - statusText == "Credenciales institucionales inválidas."; + statusText == "Usuario o contraseña incorrectos."; Console.WriteLine(JsonSerializer.Serialize(new { passed = rejectionPassed, @@ -216,7 +216,7 @@ internal static class Program ? serializedCredentialPassed && statusIcon == (int)StatusIcon.None && string.IsNullOrEmpty(statusText) : serializedCredentialPassed && statusIcon == (int)StatusIcon.Warning && - statusText == "Servicio institucional no disponible; Windows validará la última contraseña de dominio registrada."; + statusText == "El servicio de autenticación no está disponible; Windows validará la última contraseña de dominio registrada."; Console.WriteLine(JsonSerializer.Serialize(new { passed, diff --git a/tests/SGU.CredentialProvider.Tests/ProviderTileIconTests.cs b/tests/SGU.CredentialProvider.Tests/ProviderTileIconTests.cs index bcad555..1004e51 100644 --- a/tests/SGU.CredentialProvider.Tests/ProviderTileIconTests.cs +++ b/tests/SGU.CredentialProvider.Tests/ProviderTileIconTests.cs @@ -55,8 +55,8 @@ public sealed class ProviderTileIconTests LargeLabelControl heading = Assert.Single(controls.OfType()); SguCredentialTile tile = Assert.IsType(provider.CreateGenericTile()); - Assert.Equal("La Salle · Acceso SGU", providerLabel.Label); - Assert.Equal("Acceso institucional SGU", heading.Label); + Assert.Equal("La Salle", providerLabel.Label); + Assert.Equal("Iniciar sesión", heading.Label); Assert.Equal(FieldState.DisplayInSelectedTile, heading.State); Assert.Equal(GenericTileDisplayMode.DisplayAsDedicatedTile, tile.GenericTileDisplayMode); Assert.IsAssignableFrom(tile);