Skip to content

Strip Prefix breaking OAuth Flow - spring-cloud-gateway-server-mvc-4.3.0-M3 #3759

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
joaquinjsb opened this issue Apr 11, 2025 · 0 comments

Comments

@joaquinjsb
Copy link

joaquinjsb commented Apr 11, 2025

Describe the bug
The stripPrefix filter is interfering with redirect URLs in my Spring Authorization Server OAuth flow, specifically because the state parameter, which includes an equals sign (=), is being incorrectly processed.

for example:
/{route}/oauth2/authorize?state=EKAqtHTLsbuIH2P6jZAZhuRqzUfdTU2OnrVvDPKdcZ0%3D&redirect_uri=....

here's the exception:

java.lang.IllegalArgumentException: Invalid character '=' for QUERY_PARAM in "EKAqtHTLsbuIH2P6jZAZhuRqzUfdTU2OnrVvDPKdcZ0="
	at org.springframework.web.util.HierarchicalUriComponents.verifyUriComponent(HierarchicalUriComponents.java:422) ~[spring-web-6.2.5.jar:6.2.5]
	at org.springframework.web.util.HierarchicalUriComponents.lambda$verify$4(HierarchicalUriComponents.java:390) ~[spring-web-6.2.5.jar:6.2.5]
	at org.springframework.util.UnmodifiableMultiValueMap.lambda$forEach$0(UnmodifiableMultiValueMap.java:115) ~[spring-core-6.2.5.jar:6.2.5]
	at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:986) ~[na:na]
	at org.springframework.util.MultiValueMapAdapter.forEach(MultiValueMapAdapter.java:179) ~[spring-core-6.2.5.jar:6.2.5]
	at org.springframework.util.UnmodifiableMultiValueMap.forEach(UnmodifiableMultiValueMap.java:115) ~[spring-core-6.2.5.jar:6.2.5]
	at org.springframework.web.util.HierarchicalUriComponents.verify(HierarchicalUriComponents.java:387) ~[spring-web-6.2.5.jar:6.2.5]
	at org.springframework.web.util.HierarchicalUriComponents.<init>(HierarchicalUriComponents.java:146) ~[spring-web-6.2.5.jar:6.2.5]
	at org.springframework.web.util.UriComponentsBuilder.buildInternal(UriComponentsBuilder.java:346) ~[spring-web-6.2.5.jar:6.2.5]
	at org.springframework.web.util.UriComponentsBuilder.build(UriComponentsBuilder.java:334) ~[spring-web-6.2.5.jar:6.2.5]
	at org.springframework.cloud.gateway.server.mvc.filter.BeforeFilterFunctions.lambda$stripPrefix$32(BeforeFilterFunctions.java:438) ~[spring-cloud-gateway-server-mvc-4.3.0-M3.jar:4.3.0-M3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant