Fetch user roles after a successful forced binded ldap login.

Signed-off-by: JACQUES Francois <fjacques@murex.com>
This commit is contained in:
JACQUES Francois 2016-02-17 12:57:57 +01:00
parent 8068aeead9
commit 1f75ab178c
1 changed files with 22 additions and 19 deletions

View File

@ -415,32 +415,35 @@ public class LdapLoginModule extends AbstractLoginModule
return isAuthenticated(); return isAuthenticated();
} }
boolean authed = false;
if (_forceBindingLogin) 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 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 //only fetch roles if authenticated
if (authed) if (authed)
getCurrentUser().fetchRoles(); getCurrentUser().fetchRoles();
return authed; return authed;
} }
catch (UnsupportedCallbackException e) catch (UnsupportedCallbackException e)