Results 1 to 2 of 2

Thread: OAuth2ClientHttpRequestFactory and extra request parameters

  1. #1
    Join Date
    Sep 2008
    Location
    Kiev, Ukraine
    Posts
    14

    Default OAuth2ClientHttpRequestFactory and extra request parameters

    Have another problem with OAuth2ClientHttpRequestFactory in this time
    Check out this code:
    Code:
    protected URI appendQueryParameter(URI uri, OAuth2AccessToken accessToken) {
        try {
          String query = uri.getQuery();
          if (query == null) {
            query = ((resource.getBearerTokenName() == null) ? "oauth_token" : resource.getBearerTokenName()) + "=" + URLEncoder.encode(accessToken.getValue(), "UTF-8");
          }
          uri = new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(), uri.getPath(), query, uri.getFragment());
          return uri;
        }
        catch (RuntimeException e) {
          throw e;
        }
        catch (Exception e) {
          throw new RuntimeException(e);
        }
      }
    IMHO, totaly wrong. Suppose I have url - https://graph.facebook.com/me/friends?metadata=1. What happen? Exactly, factory will NOT ADD access token to request, because request has already have query parameters. Again, as I wrote earlier, http factory is not good place for oauth decoration. I think there should be specila message converter for that.
    Code:
    if (var) return true;
    else if (!var) return false;
    else return !true&&!false; // :-)

  2. #2
    Join Date
    May 2008
    Location
    Salt Lake City
    Posts
    167

    Default

    thanks for the report. the code is fixed on master.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •