@@ -43,6 +43,7 @@ of this software and associated documentation files (the "Software"), to deal
43
43
import hudson .tasks .Mailer ;
44
44
import hudson .util .Secret ;
45
45
import jenkins .model .Jenkins ;
46
+ import jenkins .security .SecurityListener ;
46
47
import org .acegisecurity .Authentication ;
47
48
import org .acegisecurity .AuthenticationException ;
48
49
import org .acegisecurity .AuthenticationManager ;
@@ -79,14 +80,11 @@ of this software and associated documentation files (the "Software"), to deal
79
80
import javax .annotation .Nonnull ;
80
81
import javax .annotation .Nullable ;
81
82
import java .io .IOException ;
82
- import java .lang .reflect .InvocationTargetException ;
83
- import java .lang .reflect .Method ;
84
83
import java .net .InetSocketAddress ;
85
84
import java .net .Proxy ;
86
85
import java .util .Arrays ;
87
86
import java .util .HashSet ;
88
87
import java .util .Set ;
89
- import java .util .logging .Level ;
90
88
import java .util .logging .Logger ;
91
89
92
90
/**
@@ -392,7 +390,7 @@ public HttpResponse doFinishLogin(StaplerRequest request)
392
390
}
393
391
}
394
392
395
- fireAuthenticated (new GithubOAuthUserDetails (self .getLogin (), auth .getAuthorities ()));
393
+ SecurityListener . fireAuthenticated (new GithubOAuthUserDetails (self .getLogin (), auth .getAuthorities ()));
396
394
} else {
397
395
Log .info ("Github did not return an access token." );
398
396
}
@@ -429,25 +427,6 @@ private String getAccessToken(@Nonnull String code) throws IOException {
429
427
return null ;
430
428
}
431
429
432
- /**
433
- * Calls {@code SecurityListener.fireAuthenticated()} but through reflection to avoid
434
- * hard dependency on non-LTS core version.
435
- * TODO delete in 1.569+
436
- */
437
- private void fireAuthenticated (UserDetails details ) {
438
- try {
439
- Class <?> c = Class .forName ("jenkins.security.SecurityListener" );
440
- Method m = c .getMethod ("fireAuthenticated" , UserDetails .class );
441
- m .invoke (null ,details );
442
- } catch (ClassNotFoundException | NoSuchMethodException e ) {
443
- // running with old core
444
- } catch (IllegalAccessException e ) {
445
- throw (Error )new IllegalAccessError (e .getMessage ()).initCause (e );
446
- } catch (InvocationTargetException e ) {
447
- LOGGER .log (Level .WARNING , "Failed to invoke fireAuthenticated" , e );
448
- }
449
- }
450
-
451
430
/**
452
431
* Returns the proxy to be used when connecting to the given URI.
453
432
*/
0 commit comments