Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[FIXED JENKINS-11720] Unhandled AuthenticationException causes Except…
…ionTranslationFilter to initiate the authentication, but for check methods it makes no sense. So catch them, and report it as a problem.
  • Loading branch information
kohsuke committed Nov 30, 2011
1 parent 9bcf9b0 commit 471566d
Showing 1 changed file with 9 additions and 0 deletions.
Expand Up @@ -39,6 +39,7 @@
import hudson.Functions;
import hudson.Extension;
import net.sf.json.JSONObject;
import org.acegisecurity.AuthenticationException;
import org.acegisecurity.userdetails.UsernameNotFoundException;
import org.acegisecurity.acls.sid.Sid;
import org.kohsuke.stapler.Stapler;
Expand Down Expand Up @@ -308,6 +309,9 @@ public FormValidation doCheckName_(String value, AccessControlled subject, Permi
// fall through next
} catch (DataAccessException e) {
// fall through next
} catch (AuthenticationException e) {
// other seemingly unexpected error.
return FormValidation.error(e,"Failed to test the validity of the user name "+v);
}

try {
Expand All @@ -320,6 +324,9 @@ public FormValidation doCheckName_(String value, AccessControlled subject, Permi
// fall through next
} catch (DataAccessException e) {
// fall through next
} catch (AuthenticationException e) {
// other seemingly unexpected error.
return FormValidation.error(e,"Failed to test the validity of the group name "+v);
}

// couldn't find it. it doesn't exist
Expand All @@ -330,5 +337,7 @@ private String makeImg(String gif) {
return String.format("<img src='%s%s/images/16x16/%s' style='margin-right:0.2em'>", Stapler.getCurrentRequest().getContextPath(), Jenkins.RESOURCE_PATH, gif);
}
}

private static final Logger LOGGER = Logger.getLogger(GlobalMatrixAuthorizationStrategy.class.getName());
}

0 comments on commit 471566d

Please sign in to comment.