Skip to content

Commit

Permalink
Revert "[JENKINS-72268] Missing permission due to desync with cache (#…
Browse files Browse the repository at this point in the history
…256)"

This reverts commit 0646c4a.
  • Loading branch information
scurvydoggo committed Nov 4, 2023
1 parent 0646c4a commit 1e8f0bc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
Expand Up @@ -504,9 +504,6 @@ private GHMyself loadMyself(@NonNull String token) throws IOException {
// Also stick into usersByIdCache (to have latest copy)
String username = ghMyself.getLogin();
usersByIdCache.put(username, new GithubUser(ghMyself));
} else {
// force creation of the gh variable, esp. in case of impersonation
getGitHub();
}
} catch (IOException e) {
LOGGER.log(Level.INFO, e.getMessage(), e);
Expand Down
11 changes: 3 additions & 8 deletions src/main/java/org/jenkinsci/plugins/GithubSecurityRealm.java
Expand Up @@ -753,15 +753,10 @@ public int hashCode() {
@Override
public GroupDetails loadGroupByGroupname(String groupName)
throws UsernameNotFoundException, DataAccessException {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (authentication == null) {
throw new UsernameNotFoundException("No known group: " + groupName);
}
if (!(authentication instanceof GithubAuthenticationToken)) {
throw new UserMayOrMayNotExistException("The received token is not a GitHub one");
}
GithubAuthenticationToken authToken = (GithubAuthenticationToken) SecurityContextHolder.getContext().getAuthentication();

GithubAuthenticationToken authToken = (GithubAuthenticationToken) authentication;
if(authToken == null)
throw new UsernameNotFoundException("No known group: " + groupName);

Check warning on line 759 in src/main/java/org/jenkinsci/plugins/GithubSecurityRealm.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 756-759 are not covered by tests

try {
int idx = groupName.indexOf(GithubOAuthGroupDetails.ORG_TEAM_SEPARATOR);
Expand Down

0 comments on commit 1e8f0bc

Please sign in to comment.