oltu-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Antonio Sanso (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (OLTU-13) Client defined HTTP headers in OAuthClientRequest
Date Mon, 25 Nov 2013 13:23:36 GMT

    [ https://issues.apache.org/jira/browse/OLTU-13?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13831447#comment-13831447
] 

Antonio Sanso commented on OLTU-13:
-----------------------------------

source code guide in  http://oltu.apache.org/source-repository.html

> Client defined HTTP headers in OAuthClientRequest
> -------------------------------------------------
>
>                 Key: OLTU-13
>                 URL: https://issues.apache.org/jira/browse/OLTU-13
>             Project: Apache Oltu
>          Issue Type: Bug
>          Components: oauth2-client
>            Reporter: Peter Turcsanyi
>            Assignee: Antonio Sanso
>              Labels: newbie
>             Fix For: 0.31
>
>
> HTTP headers added to OAuthClientRequest are not sent with the HTTP request.
> I would like to use HTTP Basic authentication at the token endpoint.
> So on the client side I add "Authorization" HTTP header to OAuthClientRequest calling
its setHeader() method.
> But headers set on the OAuthClientRequest object are not processed by OAuthClient.accessToken()
/ URLConnectionClient.execute(), therefore they are not sent to the authorization server.
> Or is there any other way to use HTTP Basic authentication between the client and the
token endpoint of the authorization server?
> The client code:
> {code}
> OAuthClientRequest tokenRequest = OAuthClientRequest
>         .tokenLocation("https://...")
>         .setGrantType(GrantType.AUTHORIZATION_CODE)
>         .setClientId("...")
>         .setClientSecret("...")
>         .setRedirectURI("https://...")
>         .setCode(authzCode)
>         .buildBodyMessage();
> if (tokenRequest.getHeaders() == null) {
>     tokenRequest.setHeaders(new HashMap<String, String>()); // nice-to-have issue:
it should be initialized inside OAuthClientRequest at creation time or at first call of setHeader()
> }
> tokenRequest.setHeader("Authorization", "..."); // main issue: header never used later
> OAuthClient oAuthClient = new OAuthClient(new URLConnectionClient());
> OAuthJSONAccessTokenResponse tokenResponse = oAuthClient.accessToken(tokenRequest);
> {code}



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message