Skip to content

Commit

Permalink
[JENKINS-34254] Adapt to upstream change using ServiceLoader
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-beck committed Dec 11, 2017
1 parent b27bb92 commit 2f45a23
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions core/src/main/java/hudson/security/csrf/CrumbFilter.java
Expand Up @@ -8,6 +8,9 @@
import hudson.util.MultipartFormDataParser;
import jenkins.model.Jenkins;
import org.acegisecurity.providers.anonymous.AnonymousAuthenticationToken;
import org.kohsuke.MetaInfServices;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.stapler.ForwardToView;
import org.kohsuke.stapler.interceptor.RequirePOST;

Expand Down Expand Up @@ -43,13 +46,16 @@ public CrumbIssuer getCrumbIssuer() {
return h.getCrumbIssuer();
}

@Restricted(NoExternalUse.class)
@MetaInfServices
public static class ErrorCustomizer implements RequirePOST.ErrorCustomizer {
@Override
public ForwardToView getForwardView() {
return new ForwardToView(CrumbFilter.class, "retry");
}
}

public void init(FilterConfig filterConfig) throws ServletException {
RequirePOST.Processor.registerErrorHandler(new RequirePOST.ErrorHandler() {
@Override
public ForwardToView getForwardView() {
return new ForwardToView(CrumbFilter.this, "retry");
}
});
}

public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
Expand Down

0 comments on commit 2f45a23

Please sign in to comment.