Fix the case when user is directly deleted in LDAP server

This commit is contained in:
mposolda committed 2014-04-09 00:06:04 +02:00
1 parent c8c4cfbaae
commit 0d00db281a
1 file changed
+3
@@ -211,6 +211,9 @@ public class AuthenticationProviderManager {
private void checkCorrectAuthLink(AuthenticationProvider authProvider, AuthenticationProviderModel providerModel,
AuthenticationLinkModel authLinkModel, String username) throws AuthenticationProviderException {
AuthUser authUser = authProvider.getUser(realm, providerModel.getConfig(), username);
if (authUser == null) {
throw new AuthenticationProviderException("User " + username + " not found in authentication provider " + providerModel.getProviderName());
}
String userExternalId = authUser.getId();
if (!userExternalId.equals(authLinkModel.getAuthUserId())) {
throw new AuthenticationProviderException("ID did not match! ID from provider: " + userExternalId + ", ID from authentication link: " + authLinkModel.getAuthUserId());