Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Close #18 - Basic API authentication is possible again

I've prevented the unhandled exceptions and converted them
into standard exceptions. This way, it seems that the basic auth
filter catches the exceptions and validates the api token.
(cherry picked from commit c6ea77d)

Signed-off-by: Oren Held <oren@onavo.com>
  • Loading branch information...
commit e3dc5ddcdc9654840bc085b243b7c6032f1cb504 1 parent 88f6ee7
@luisfaceira luisfaceira authored committed
Showing with 6 additions and 0 deletions.
  1. +6 −0 src/main/java/org/jenkinsci/plugins/GithubSecurityRealm.java
View
6 src/main/java/org/jenkinsci/plugins/GithubSecurityRealm.java
@@ -426,6 +426,9 @@ public UserDetails loadUserByUsername(String username)
GithubAuthenticationToken authToken = (GithubAuthenticationToken) SecurityContextHolder.getContext().getAuthentication();
+ if (authToken == null)
+ throw new UsernameNotFoundException("no known user: " + username);
+
try {
GroupDetails group = loadGroupByGroupname(username);
@@ -458,6 +461,9 @@ public GroupDetails loadGroupByGroupname(String groupName)
GithubAuthenticationToken authToken = (GithubAuthenticationToken) SecurityContextHolder.getContext().getAuthentication();
+ if(authToken == null)
+ throw new UsernameNotFoundException("no known group: " + groupName);
+
try {
GHOrganization org = authToken.loadOrganization(groupName);
Please sign in to comment.
Something went wrong with that request. Please try again.