3737
3838import javax .naming .NameNotFoundException ;
3939
40- import jenkins .security .SecurityListener ;
4140import org .acegisecurity .AuthenticationException ;
4241import org .acegisecurity .AuthenticationServiceException ;
4342import org .acegisecurity .BadCredentialsException ;
@@ -221,9 +220,7 @@ protected UserDetails retrieveUser(final String username, final UsernamePassword
221220
222221 for (ActiveDirectoryDomain domain : domains ) {
223222 try {
224- UserDetails userDetails = retrieveUser (username , authentication , domain );
225- SecurityListener .fireAuthenticated (userDetails );
226- return userDetails ;
223+ return retrieveUser (username , authentication , domain );
227224 } catch (NamingException ne ) {
228225 if (userMatchesInternalDatabaseUser (username )) {
229226 LOGGER .log (Level .WARNING , String .format ("Looking into Jenkins Internal Users Database for user %s" , username ));
@@ -235,9 +232,7 @@ protected UserDetails retrieveUser(final String username, final UsernamePassword
235232 }
236233 if (hudsonPrivateSecurityRealm .isPasswordCorrect (password )) {
237234 LOGGER .log (Level .INFO , String .format ("Falling back into the internal user %s" , username ));
238- UserDetails userDetails = new ActiveDirectoryUserDetail (username , "redacted" , true , true , true , true , hudsonPrivateSecurityRealm .getAuthorities (), internalUser .getDisplayName (), "" , "" );
239- SecurityListener .fireAuthenticated (userDetails );
240- return userDetails ;
235+ return new ActiveDirectoryUserDetail (username , "redacted" , true , true , true , true , hudsonPrivateSecurityRealm .getAuthorities (), internalUser .getDisplayName (), "" , "" );
241236 } else {
242237 LOGGER .log (Level .WARNING , String .format ("Credential exception trying to authenticate against %s domain" , domain .getName ()), ne );
243238 errors .add (new MultiCauseUserMayOrMayNotExistException ("We can't tell if the user exists or not: " + username , notFound ));
0 commit comments