Skip to content
This repository has been archived by the owner on Dec 10, 2023. It is now read-only.

Commit

Permalink
Fix for bug JENKINS-11418 "Crowd2 doesn't always show full user name"
Browse files Browse the repository at this point in the history
  • Loading branch information
theit committed Oct 26, 2011
1 parent 52cccb7 commit f1ea3b3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 20 deletions.
Expand Up @@ -56,6 +56,7 @@
import com.atlassian.crowd.exception.InvalidAuthenticationException;
import com.atlassian.crowd.exception.OperationFailedException;
import com.atlassian.crowd.exception.UserNotFoundException;
import com.atlassian.crowd.model.user.User;

/**
* This class implements the authentication manager for Jenkins.
Expand Down Expand Up @@ -122,12 +123,15 @@ public Authentication authenticate(Authentication authentication)
username, this.configuration.groupName));
}

String displayName = null;
try {
// authenticate user
if (LOG.isLoggable(Level.FINE)) {
LOG.fine("Authenticating user: " + username);
}
this.configuration.crowdClient.authenticateUser(username, password);
User user = this.configuration.crowdClient.authenticateUser(
username, password);
displayName = user.getDisplayName();
} catch (UserNotFoundException ex) {
LOG.info(userNotFound(username));
throw new BadCredentialsException(userNotFound(username), ex);
Expand Down Expand Up @@ -165,6 +169,8 @@ public Authentication authenticate(Authentication authentication)
if (LOG.isLoggable(Level.FINE)) {
LOG.fine("User successfully authenticated; creating authentication token");
}
return new CrowdAuthenticationToken(username, password, authorities);

return new CrowdAuthenticationToken(username, password, authorities,
null, displayName);
}
}
18 changes: 0 additions & 18 deletions src/main/java/de/theit/jenkins/crowd/CrowdAuthenticationToken.java
Expand Up @@ -54,24 +54,6 @@ public class CrowdAuthenticationToken extends AbstractAuthenticationToken {
/** The display name of the user. */
private String displayName;

/**
* Creates a new authorization token.
*
* @param pPrincipal
* The name of the authenticated Crowd user. May not be
* <code>null</code>.
* @param pCredentials
* The credentials. Normally the users password. May not be
* <code>null</code>.
* @param authorities
* The list of granted authorities for the user. May not be
* <code>null</code>.
*/
public CrowdAuthenticationToken(String pPrincipal, String pCredentials,
List<GrantedAuthority> authorities) {
this(pPrincipal, pCredentials, authorities, null, null);
}

/**
* Creates a new authorization token.
*
Expand Down

0 comments on commit f1ea3b3

Please sign in to comment.