Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
...
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 2 contributors
Commits on Mar 04, 2013
@luisfaceira luisfaceira 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>
e3dc5dd
@orenhe Fix POM dependency c3a083d
Showing with 11 additions and 0 deletions.
  1. +5 −0 pom.xml
  2. +6 −0 src/main/java/org/jenkinsci/plugins/GithubSecurityRealm.java
View
5 pom.xml
@@ -71,6 +71,11 @@
<artifactId>json</artifactId>
<version>20090211</version>
</dependency>
+ <dependency>
+ <groupId>net.java.dev.jna</groupId>
+ <artifactId>jna</artifactId>
+ <version>3.2.2</version>
+ </dependency>
</dependencies>
<build>
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);

No commit comments for this range

Something went wrong with that request. Please try again.