Active Directory rejects the LDAP bind with error 49, AcceptSecurityContext, data 52e
Your error
[LDAP: error code 49 - 80090308: LdapErr: DSID-0C090439, comment: AcceptSecurityContext error, data 52e2 more lines it can showFix it fast
Most common cause, 1 of 4data 52e: the password for that bind name is wrong
Correct the password for the account that failed.
# application.properties
spring.ldap.urls=ldap://dc1.example.com:389
spring.ldap.username=svc-app@example.com
spring.ldap.password=${LDAP_BIND_PASSWORD}Short answer
LDAP error code 49 with AcceptSecurityContext error is Active Directory's invalidCredentials, and the data value says why. data 52e is ERROR_LOGON_FAILURE: the name matched an account but the password was wrong. 525 means no such user, 532 or 773 an expired or must-change password, and 533, 701 or 775 a disabled, expired or locked account. AD DS, Spring Security 7.2.
Which cause do you have?
Pull the data code out of your logs. 52e points to cause 1, 525 or 57 to cause 2, 532 or 773 to cause 3, and 533, 701 or 775 to cause 4.
grep -oE "data [0-9a-f]{2,4}" app.log | sort | uniq -cThen find the line you see in this list and open its fix:
- 1data 52e: the password for that bind name is wrong
data 52e (decimal 1326, ERROR_LOGON_FAILURE), whether a user logs in or the application binds with its own service account - 2data 525 or 57: the bind name does not map to the account
data 525 (user not found) or data 57 (ERROR_INVALID_PARAMETER) instead of 52e - 3data 532 or 773: the password has expired or must be changed
data 532 (password expired) or data 773 (user must reset password) - 4data 533, 701 or 775: the account is disabled, expired or locked
data 533 (account disabled), data 701 (account expired) or data 775 (account locked)
What does the error look like?
[LDAP: error code 49 - 80090308: LdapErr: DSID-0C090439, comment: AcceptSecurityContext error, data 52ejavax.naming.AuthenticationException: [LDAP: error code 49 - 80090308: LdapErr: ... AcceptSecurityContext error, data 775Active Directory authentication failed: Supplied password was invalid
Cause 1 of 4
data 52e: the password for that bind name is wrong
You seedata 52e (decimal 1326, ERROR_LOGON_FAILURE), whether a user logs in or the application binds with its own service account
Check
LDAP error code 49 with data 52e means the bind name resolved to exactly one Active Directory object and the password check on that object failed. Microsoft lists 0x52E as ERROR_LOGON_FAILURE, the user name or password is incorrect. If every login fails, including users with known-good passwords, look at the service account in spring.ldap.username and spring.ldap.password first.
ldapwhoami -x -H ldap://dc1.example.com -D "svc-app@example.com" -WFix
Correct the password for the account that failed. For the application's own bind account, update spring.ldap.password from your secret store and restart; for a user, the user signs in again with the right password.
# application.properties
spring.ldap.urls=ldap://dc1.example.com:389
spring.ldap.username=svc-app@example.com
spring.ldap.password=${LDAP_BIND_PASSWORD}Verify
ldapwhoami returns without an error for the same name and password, and the application log shows no new data 52e lines.
ldapwhoami -x -H ldap://dc1.example.com -D "svc-app@example.com" -WConfirmed by learn.microsoft.com
Cause 2 of 4
data 525 or 57: the bind name does not map to the account
You seedata 525 (user not found) or data 57 (ERROR_INVALID_PARAMETER) instead of 52e
Check
Active Directory tries several name forms for a simple bind: the DN, the UPN, DOMAIN\user and a few others. When the name matches no object, the bind fails with invalidCredentials and ERROR_INVALID_PARAMETER. Spring's ActiveDirectoryLdapAuthenticationProvider builds the UPN by adding the configured domain to the typed username, so a domain that differs from the UPN suffix produces a name AD cannot find.
Get-ADUser -Identity jdoe -Properties UserPrincipalName | Select-Object UserPrincipalNameFix
Set the provider's domain to the UPN suffix shown on the account (for example example.com), not a NetBIOS name, or have users sign in with the full user@domain form.
@Bean
ActiveDirectoryLdapAuthenticationProvider adProvider() {
var provider = new ActiveDirectoryLdapAuthenticationProvider(
"example.com", "ldap://dc1.example.com/");
provider.setConvertSubErrorCodesToExceptions(true);
return provider;
}Verify
A login with the short username succeeds, and ldapwhoami accepts the full user@domain name.
ldapwhoami -x -H ldap://dc1.example.com -D "jdoe@example.com" -WConfirmed by raw.githubusercontent.com
Cause 3 of 4
data 532 or 773: the password has expired or must be changed
You seedata 532 (password expired) or data 773 (user must reset password)
Check
Spring Security's list of Active Directory sub-error codes reads 532 as password expired and 773 as user must reset password, and Microsoft's table lists 0x532 as ERROR_PASSWORD_EXPIRED. The old password is refused even when it is typed correctly.
Search-ADAccount -PasswordExpired -UsersOnly | Format-Table Name,SamAccountName -AutoSizeFix
Set a new password for the account (an administrator can do it with Set-ADAccountPassword), then update any application that stores it.
$NewPassword = Read-Host -Prompt "New password" -AsSecureString
Set-ADAccountPassword -Identity svc-app -NewPassword $NewPassword -ResetVerify
The account no longer appears in the PasswordExpired search, and the bind succeeds with the new password.
Search-ADAccount -PasswordExpired -UsersOnly | Where-Object SamAccountName -eq 'svc-app'Confirmed by learn.microsoft.com
Cause 4 of 4
data 533, 701 or 775: the account is disabled, expired or locked
You seedata 533 (account disabled), data 701 (account expired) or data 775 (account locked)
Check
These codes mean Active Directory refuses the account itself, whatever password is sent. Microsoft lists 0x533 as ERROR_ACCOUNT_DISABLED, and Spring Security turns 533, 701 and 775 into DisabledException, AccountExpiredException and LockedException when sub-error conversion is on.
Search-ADAccount -LockedOut -UsersOnly | Format-Table Name,SamAccountName -AutoSize
Search-ADAccount -AccountDisabled -UsersOnly | Format-Table Name,SamAccountName -AutoSizeFix
Unlock or enable the account, and ask the directory owner to extend an expired one. If a service account keeps locking, find the system still sending its old password before unlocking it again.
Unlock-ADAccount -Identity svc-app
Enable-ADAccount -Identity svc-appVerify
Both searches no longer list the account, and the next bind succeeds.
Search-ADAccount -LockedOut -UsersOnly | Where-Object SamAccountName -eq 'svc-app'Confirmed by learn.microsoft.com
How do I stop it coming back?
- Call setConvertSubErrorCodesToExceptions(true) on the Active Directory provider so locked, disabled and expired accounts surface as their own exceptions instead of plain bad credentials.
- Keep the bind account's password in one secret store entry, so a rotation updates every application that binds with it.
- Alert on repeated data 775 lines for the service account, so a lockout is noticed before users report failed logins.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine on the same stack: Dispatch Pro.