Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-5226

OAuth public clients don't appear to work in RedirectionGrantServices

    XMLWordPrintableJSON

Details

    • 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.

      Attachments

        Activity

          People

            sergey_beryozkin Sergey Beryozkin
            diarmuid.power Diarmuid Power
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: