MiG MiG - 1 year ago 120
Java Question

Spring LDAP security keep reseting

II have a Spring - Security login that - after I put my user/pass, enters here:

public UserDetails mapUserFromContext(final DirContextOperations ctx,
final String username,
final Collection<? extends GrantedAuthority> authorities) {
LOGGER.debug("mapUserFromContext(username={})...", username);

for (GrantedAuthority authority : authorities) {
LOGGER.info("user: {} >> role: {}", username, authority.getAuthority());

LOGGER.debug("DONE >> mapUserFromContext(username={}).", username);

EFormUserDetails eFormUserDetails = new EFormUserDetails();
eFormUserDetails.setJudet(securityUtils.getLoggedInUserJudet(authorities, username));
LOGGER.debug("3.mapUserFromContext(after securityUtils.getLoggedInUserJudet).");

return eFormUserDetails;

I get "3.mapUserFromContext(after securityUtils.getLoggedInUserJudet)." in my logger but the login window reset asking me again the user/pass. Where to put a logger to see what happens after it returns eFormUserDetails?

I must say that on my dev env. it works ok, the problem appears on production, where they have an proxy and an secure certified address for my app.


Answer Source

Try putting a debug in

protected Authentication createSuccessfulAuthentication(UsernamePasswordAuthenticationToken authentication,
            UserDetails user){


method of AbstractLdapAuthenticationProvider as here only successful authentication object is created after successful login.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download