From 471566ddfa4e2bf9aa5ba0685020a6d233b5b010 Mon Sep 17 00:00:00 2001 From: Kohsuke Kawaguchi Date: Tue, 29 Nov 2011 17:29:09 -0800 Subject: [PATCH] [FIXED JENKINS-11720] Unhandled AuthenticationException causes ExceptionTranslationFilter to initiate the authentication, but for check methods it makes no sense. So catch them, and report it as a problem. --- .../security/GlobalMatrixAuthorizationStrategy.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core/src/main/java/hudson/security/GlobalMatrixAuthorizationStrategy.java b/core/src/main/java/hudson/security/GlobalMatrixAuthorizationStrategy.java index 599d513d26..0e551ce5f9 100644 --- a/core/src/main/java/hudson/security/GlobalMatrixAuthorizationStrategy.java +++ b/core/src/main/java/hudson/security/GlobalMatrixAuthorizationStrategy.java @@ -39,6 +39,7 @@ import hudson.util.RobustReflectionConverter; 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; @@ -308,6 +309,9 @@ public class GlobalMatrixAuthorizationStrategy extends AuthorizationStrategy { // 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 { @@ -320,6 +324,9 @@ public class GlobalMatrixAuthorizationStrategy extends AuthorizationStrategy { // 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 @@ -330,5 +337,7 @@ public class GlobalMatrixAuthorizationStrategy extends AuthorizationStrategy { return String.format("", Stapler.getCurrentRequest().getContextPath(), Jenkins.RESOURCE_PATH, gif); } } + + private static final Logger LOGGER = Logger.getLogger(GlobalMatrixAuthorizationStrategy.class.getName()); }