File tree Expand file tree Collapse file tree
src/main/java/org/jenkinsci/plugins Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -504,9 +504,6 @@ private GHMyself loadMyself(@NonNull String token) throws IOException {
504504 // Also stick into usersByIdCache (to have latest copy)
505505 String username = ghMyself .getLogin ();
506506 usersByIdCache .put (username , new GithubUser (ghMyself ));
507- } else {
508- // force creation of the gh variable, esp. in case of impersonation
509- getGitHub ();
510507 }
511508 } catch (IOException e ) {
512509 LOGGER .log (Level .INFO , e .getMessage (), e );
Original file line number Diff line number Diff line change @@ -753,15 +753,10 @@ public int hashCode() {
753753 @ Override
754754 public GroupDetails loadGroupByGroupname (String groupName )
755755 throws UsernameNotFoundException , DataAccessException {
756- Authentication authentication = SecurityContextHolder .getContext ().getAuthentication ();
757- if (authentication == null ) {
758- throw new UsernameNotFoundException ("No known group: " + groupName );
759- }
760- if (!(authentication instanceof GithubAuthenticationToken )) {
761- throw new UserMayOrMayNotExistException ("The received token is not a GitHub one" );
762- }
756+ GithubAuthenticationToken authToken = (GithubAuthenticationToken ) SecurityContextHolder .getContext ().getAuthentication ();
763757
764- GithubAuthenticationToken authToken = (GithubAuthenticationToken ) authentication ;
758+ if (authToken == null )
759+ throw new UsernameNotFoundException ("No known group: " + groupName );
765760
766761 try {
767762 int idx = groupName .indexOf (GithubOAuthGroupDetails .ORG_TEAM_SEPARATOR );
You can’t perform that action at this time.
0 commit comments