Skip to content

Commit

Permalink
[JENKINS-22469] Do not perform authentication when readResolve is cal…
Browse files Browse the repository at this point in the history
…led on startup.
  • Loading branch information
ikedam committed Apr 5, 2014
1 parent 6451b35 commit ac6f88b
Showing 1 changed file with 10 additions and 6 deletions.
Expand Up @@ -38,8 +38,8 @@
import hudson.model.AbstractProject;
import hudson.model.Descriptor;
import hudson.model.Descriptor.FormException;
import hudson.security.ACL;
import hudson.util.FormValidation;

import net.sf.json.JSONObject;

import org.acegisecurity.Authentication;
Expand Down Expand Up @@ -191,11 +191,15 @@ protected static SpecificUsersAuthorizationStrategy getCurrentStrategy(AbstractP
* @throws IOException authentication failed.
*/
private Object readResolve() throws IOException {
// There's no way to retrieve current strategy.
if (isAuthenticateionRequired(this, null)) {
// As REST/CLI interface saves configuration after successfully load object from the XML,
// this prevents the new configuration saved.
throw new IOException(Messages.SpecificUsersAuthorizationStrategy_userid_readResolve());
if (!ACL.SYSTEM.equals(Jenkins.getAuthentication())) {
// This is called via REST/CLI.

// There's no way to retrieve current strategy.
if (isAuthenticateionRequired(this, null)) {
// As REST/CLI interface saves configuration after successfully load object from the XML,
// this prevents the new configuration saved.
throw new IOException(Messages.SpecificUsersAuthorizationStrategy_userid_readResolve());
}
}
return this;
}
Expand Down

0 comments on commit ac6f88b

Please sign in to comment.