Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.7.6
-
None
-
Unknown
Description
I believe there is an issue when using a redirect grant service using a public client.
My concern is the negation in front of the canSupportPublicClient which passes this value to the OAuthUtils.isGrantSupportedForClient as if it had not been negated.
if (!OAuthUtils.isGrantSupportedForClient(client, !canSupportPublicClient(client), supportedGrantType)) { return createErrorResponse(params, redirectUri, OAuthConstants.UNAUTHORIZED_CLIENT);
org.apache.cxf.rs.security.oauth2.services.startAuthorization()
This method then checks for a logical condition like, is public client and provider cannot support public clients. Instead, the logic of the condition reads, if public client and provider can support public client, then throw exception.
public static boolean isGrantSupportedForClient(Client client, boolean canSupportPublicClients, String grantType) { if (!client.isConfidential() && !canSupportPublicClients) { return false;
org.apache.cxf.rs.security.oauth2.utils.OAuthUtils.isGrantSupportedForClient()
So believe this to be a bug and I wanted to submit this for your consideration.
Another note is that AccessTokenService approaches this differently and doesn't seem to start with a negation:
if (!OAuthUtils.isGrantSupportedForClient(client, isCanSupportPublicClients(), params.getFirst(OAuthConstants.GRANT_TYPE))) { return createErrorResponse(params, OAuthConstants.UNAUTHORIZED_CLIENT);
org.apache.cxf.rs.security.oauth2.services.AccessTokenService.handleTokenRequest()
P.S. First time logging an issue so apologies if I filled out any fields incorrectly.