Merge pull request #364 from hypnoce/fix_ldap_binded_login_9.3.x

9.3.x: Fetch user roles after a successful forced binded ldap login.
This commit is contained in:
Jan Bartel 2016-03-11 23:03:41 +11:00
commit 4bbc469f57
1 changed files with 22 additions and 19 deletions

View File

@ -415,32 +415,35 @@ public class LdapLoginModule extends AbstractLoginModule
return isAuthenticated();
}
boolean authed = false;
if (_forceBindingLogin)
{
return bindingLogin(webUserName, webCredential);
authed = bindingLogin(webUserName, webCredential);
}
// This sets read and the credential
UserInfo userInfo = getUserInfo(webUserName);
if (userInfo == null)
{
setAuthenticated(false);
return false;
}
setCurrentUser(new JAASUserInfo(userInfo));
boolean authed = false;
if (webCredential instanceof String)
authed = credentialLogin(Credential.getCredential((String) webCredential));
else
authed = credentialLogin(webCredential);
{
// This sets read and the credential
UserInfo userInfo = getUserInfo(webUserName);
if (userInfo == null)
{
setAuthenticated(false);
return false;
}
setCurrentUser(new JAASUserInfo(userInfo));
if (webCredential instanceof String)
authed = credentialLogin(Credential.getCredential((String) webCredential));
else
authed = credentialLogin(webCredential);
}
//only fetch roles if authenticated
if (authed)
getCurrentUser().fetchRoles();
return authed;
}
catch (UnsupportedCallbackException e)