Honor exact SGO passwords for managed domain users
This commit is contained in:
1 parent
738df9ceea
commit
843a1956d6
11 files changed
+224
-19
No files matched your search
@@ -2,9 +2,15 @@ $repositoryRoot = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path
|
||||
$synchronizerPath = Join-Path $repositoryRoot 'src\SGU.AuthBroker\Services\ActiveDirectorySynchronizer.cs'
|
||||
$deployPath = Join-Path $repositoryRoot 'scripts\Deploy-AuthBroker.ps1'
|
||||
$userPolicyPath = Join-Path $repositoryRoot 'scripts\Set-SguDomainUserPolicies.ps1'
|
||||
$passwordPolicyPath = Join-Path $repositoryRoot 'scripts\Set-SguInstitutionalPasswordPolicy.ps1'
|
||||
$bootstrapPath = Join-Path $repositoryRoot 'scripts\Initialize-SguDomainController.ps1'
|
||||
$packagePath = Join-Path $repositoryRoot 'scripts\New-SguBootstrapPackages.ps1'
|
||||
$synchronizer = Get-Content -LiteralPath $synchronizerPath -Raw
|
||||
$deploy = Get-Content -LiteralPath $deployPath -Raw
|
||||
$userPolicy = Get-Content -LiteralPath $userPolicyPath -Raw
|
||||
$passwordPolicy = Get-Content -LiteralPath $passwordPolicyPath -Raw
|
||||
$bootstrap = Get-Content -LiteralPath $bootstrapPath -Raw
|
||||
$package = Get-Content -LiteralPath $packagePath -Raw
|
||||
|
||||
Describe 'SGU Auth Broker password authority' {
|
||||
It 'denies the Change Password extended right to SELF and Everyone before SetPassword' {
|
||||
@@ -25,4 +31,17 @@ Describe 'SGU Auth Broker password authority' {
|
||||
$userPolicy | Should Match "disableChangePasswordValueName = 'DisableChangePassword'"
|
||||
$userPolicy | Should Match '(?s)-ValueName \$disableChangePasswordValueName.*-Type DWord.*-Value 1'
|
||||
}
|
||||
|
||||
It 'scopes exact SGO passwords to all three SGU role groups without changing the domain default' {
|
||||
foreach ($role in @('Alumnos', 'Administrativos', 'Docentes')) {
|
||||
$passwordPolicy | Should Match "CN=SGU-$role,OU=$role,OU=Usuarios-SGU"
|
||||
}
|
||||
$passwordPolicy | Should Match 'ComplexityEnabled = \$false'
|
||||
$passwordPolicy | Should Match 'MinPasswordLength = 1'
|
||||
$passwordPolicy | Should Match 'PasswordHistoryCount = 0'
|
||||
$passwordPolicy | Should Match 'MaxPasswordAge = \[TimeSpan\]::Zero'
|
||||
$passwordPolicy | Should Not Match 'Set-ADDefaultDomainPasswordPolicy'
|
||||
$bootstrap | Should Match 'Set-SguInstitutionalPasswordPolicy\.ps1'
|
||||
$package | Should Match "'Set-SguInstitutionalPasswordPolicy.ps1'"
|
||||
}
|
||||
}
|
||||
@@ -46,6 +46,7 @@ public sealed class BrokerClientTests
|
||||
TestContext.Current.CancellationToken);
|
||||
|
||||
Assert.Equal(BrokerDecisionKind.InvalidCredentials, decision.Kind);
|
||||
Assert.Equal("INVALID_INSTITUTIONAL_CREDENTIALS", decision.ErrorCode);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -61,6 +62,23 @@ public sealed class BrokerClientTests
|
||||
TestContext.Current.CancellationToken);
|
||||
|
||||
Assert.Equal(BrokerDecisionKind.Unavailable, decision.Kind);
|
||||
Assert.Equal("NTLM_UPSTREAM_ERROR", decision.ErrorCode);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task SynchronizationFailureRetainsItsSpecificErrorCode()
|
||||
{
|
||||
using BrokerClient client = new(
|
||||
CreateSettings(),
|
||||
new CapturingHandler(HttpStatusCode.ServiceUnavailable, "{\"code\":\"DIRECTORY_SYNCHRONIZATION_FAILED\"}"));
|
||||
|
||||
BrokerDecision decision = await client.AuthenticateAsync(
|
||||
"AL250792",
|
||||
"SGOAccepted",
|
||||
TestContext.Current.CancellationToken);
|
||||
|
||||
Assert.Equal(BrokerDecisionKind.Unavailable, decision.Kind);
|
||||
Assert.Equal("DIRECTORY_SYNCHRONIZATION_FAILED", decision.ErrorCode);
|
||||
}
|
||||
|
||||
private static ProviderSettings CreateSettings() => new()
|
||||
|
||||
Reference in new issue
Block a user