ldap/src/main/java/org/springframework/security/ldap/authentication/AbstractLdapAuthenticationProvider.java
protected Authentication createSuccessfulAuthentication(
			UsernamePasswordAuthenticationToken authentication, UserDetails user) {
		Object password = this.useAuthenticationRequestCredentials
				? authentication.getCredentials() : user.getPassword();

		UsernamePasswordAuthenticationToken result = new UsernamePasswordAuthenticationToken(
				user, password,
				this.authoritiesMapper.mapAuthorities(user.getAuthorities()));
		result.setDetails(authentication.getDetails());

		return result;
	}
protected Authentication createSuccessfulAuthentication(
			UsernamePasswordAuthenticationToken authentication, UserDetails user) {
		Object password = this.useAuthenticationRequestCredentials
				? authentication.getCredentials() : user.getPassword();

		UsernamePasswordAuthenticationToken result = new UsernamePasswordAuthenticationToken(
				user, password,
				this.authoritiesMapper.mapAuthorities(user.getAuthorities()));
		result.setDetails(authentication.getDetails());

		return result;
	}
protected Authentication createSuccessfulAuthentication ( UsernamePasswordAuthenticationToken authentication , UserDetails user ) { Object password = this . useAuthenticationRequestCredentials ? authentication . getCredentials ( ) : user . getPassword ( ) ; UsernamePasswordAuthenticationToken result = new UsernamePasswordAuthenticationToken ( user , password , this . authoritiesMapper . mapAuthorities ( user . getAuthorities ( ) ) ) ; result . setDetails ( authentication . getDetails ( ) ) ; return result ; }
Creates the final {@code Authentication} object which will be returned from the
{@code authenticate} method.

@param authentication the original authentication request token
@param user the <tt>UserDetails</tt> instance returned by the configured
<tt>UserDetailsContextMapper</tt>.
@return the Authentication object for the fully authenticated user.
Creates the final { @code Authentication } object which will be returned from the { @code authenticate } method .