Skip to content

Commit fa86b48

Browse files
authored
Replace deprecated Spring Security AntPathRequestMatcher with non-deprecated equivalent (jenkinsci#10824)
2 parents cda842e + 91132f4 commit fa86b48

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

core/src/main/java/hudson/security/AuthenticationProcessingFilter2.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,11 @@
3939
import jenkins.util.SystemProperties;
4040
import org.kohsuke.accmod.Restricted;
4141
import org.kohsuke.accmod.restrictions.NoExternalUse;
42+
import org.springframework.http.HttpMethod;
4243
import org.springframework.security.core.Authentication;
4344
import org.springframework.security.core.AuthenticationException;
4445
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
45-
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
46+
import org.springframework.security.web.servlet.util.matcher.PathPatternRequestMatcher;
4647

4748
/**
4849
* Login filter with a change for Jenkins so that
@@ -56,7 +57,7 @@ public final class AuthenticationProcessingFilter2 extends UsernamePasswordAuthe
5657

5758
@SuppressFBWarnings(value = "HARD_CODE_PASSWORD", justification = "This is a password parameter, not a password")
5859
public AuthenticationProcessingFilter2(String authenticationGatewayUrl) {
59-
setRequiresAuthenticationRequestMatcher(new AntPathRequestMatcher("/" + authenticationGatewayUrl, "POST"));
60+
setRequiresAuthenticationRequestMatcher(PathPatternRequestMatcher.withDefaults().matcher(HttpMethod.POST, "/" + authenticationGatewayUrl));
6061
// Jenkins/login.jelly & SetupWizard/authenticate-security-token.jelly
6162
setUsernameParameter("j_username");
6263
setPasswordParameter("j_password");

0 commit comments

Comments
 (0)