-
Couldn't load subscription status.
- Fork 6.2k
Closed
Closed
Copy link
Labels
in: oauth2An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)type: bugA general bugA general bug
Description
Describe the bug
Both the SpringOpaqueTokenIntrospector and NimbusOpaqueTokenIntrospector use the clientId and clientSecret to authenticate the calls to the authorization server.
This is done via basic authentication added using a BasicAuthenticationInterceptor. This does not perform any URL encoding.
This issue was addressed in #9610 for the token granting client, but persists for the introspection client.
The workaround at the moment is to manually encode the secret when instantiating the introspector.
To Reproduce
- Set up a Spring Authorization Server with a client with a secret such as
badSecret% - Configure a
SpringOpaqueTokenIntrospectororNimbusOpaqueTokenIntrospectorto use that client - Attempt to use the introspector with the Spring Authorization Server.
- See the server respond with a 400
invalid_requesterror and see the following cause in the logs:
Caused by: java.lang.IllegalArgumentException: URLDecoder: Incomplete trailing escape (%) pattern
at java.base/java.net.URLDecoder.decode(URLDecoder.java:230) ~[?:?]
at java.base/java.net.URLDecoder.decode(URLDecoder.java:147) ~[?:?]
at org.springframework.security.oauth2.server.authorization.web.authentication.ClientSecretBasicAuthenticationConverter.convert(ClientSecretBasicAuthenticationConverter.java:85) ~[spring-security-oauth2-authorization-server-1.3.2.jar!/:1.3.2]
... 103 more
Expected behavior
The token introspector should URL encode the secret.
Metadata
Metadata
Assignees
Labels
in: oauth2An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)type: bugA general bugA general bug