Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add additional parameters to OAuth2UserRequest #5368

Closed
XYUU opened this issue May 22, 2018 · 5 comments
Closed

Add additional parameters to OAuth2UserRequest #5368

XYUU opened this issue May 22, 2018 · 5 comments
Assignees
Labels
in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) type: enhancement A general enhancement
Milestone

Comments

@XYUU
Copy link
Contributor

XYUU commented May 22, 2018

Summary

Add additional parameters to OAuth2UserRequest, some third-party OAuth2.0 service UserInfoService must have additional parameters in OAuth2AccessTokenResponse.

Actual Behavior

Cannot be used now because of missing parameters.

Expected Behavior

Expect to implement additional parameters by configuring userInfoUri.

Configuration

user-info-uri: https://api.weibo.com/2/users/show.json?uid={uid}

@rwinch rwinch added the status: waiting-for-triage An issue we've not yet triaged label May 22, 2018
@jgrandja
Copy link
Contributor

@XYUU This is not clear to me:

some third-party OAuth2.0 service UserInfoService must have additional parameters in OAuth2AccessTokenResponse

How is the UserInfoService related to a OAuth2AccessTokenResponse? Please provide more detail.

@jgrandja jgrandja added status: waiting-for-feedback We need additional information before we can continue in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) and removed status: waiting-for-triage An issue we've not yet triaged labels May 28, 2018
@XYUU
Copy link
Contributor Author

XYUU commented May 30, 2018

Some third-party OAuth2.0 service UserInfoService needs to add the additional parameters in OAuth2AccessTokenResponse to OAuth2UserRequest in order to use these parameters in UserInfoService.

Such as OAuth2 AccessToken Response:

{
    "access_token": "1.a6b7dbd428f731035f771b8d15063f61.86400.1292922000-2346678-124328",
    "expires_in": 86400,
    "refresh_token": "2.385d55f8615fdfd9edb7c4b5ebdc3e39.604800.1293440400-2346678-124328",
    "scope": "basic email",
    "uid": "90090909",
}

user-info-uri: https://api.weibo.com/2/users/show.json?uid={uid}

UserInfoService expects to expand:

https://api.weibo.com/2/users/show.json?uid=90090909&access_token=1.a6b7dbd428f731035f771b8d15063f61.86400.1292922000-2346678-124328

@jgrandja
Copy link
Contributor

I understand. Let me see what I can do and I'll get back to you shortly.

@jgrandja jgrandja removed the status: waiting-for-feedback We need additional information before we can continue label May 30, 2018
@mhyeon-lee
Copy link
Contributor

mhyeon-lee commented Jul 17, 2018

related: #5500
RFC-6750 2.3. URI Query Parameter (https://tools.ietf.org/html/rfc6750#section-2.3)

However, the Nimbus SDK does not support URI Query Parameter requests.
(SDK support Authorization Request Header Field, Form-Encoded Body Parameter)
I contacted Connect2id Support, which supports the Nimbus SDK, and I received the following response.


Hi,

First, thanks for this report.

Support including the access token as URI query parameter was deliberately omitted from the SDK because that pattern is discouraged, to prevent the token from accidentally getting recorded in server and proxy logs, etc.

https://tools.ietf.org/html/rfc6750#section-2.3
Because of the security weaknesses associated with the URI method
(see Section 5), including the high likelihood that the URL
containing the access token will be logged, it SHOULD NOT be used
unless it is impossible to transport the access token in the
"Authorization" request header field or the HTTP request entity-body.
Resource servers MAY support this method.

This method is included to document current use; its use is not
recommended, due to its security deficiencies (see Section 5) and
also because it uses a reserved query parameter name, which is
counter to URI namespace best practices, per "Architecture of the
World Wide Web, Volume One" [W3C.REC-webarch-20041215].
Are you aware of this recommendation, or do you need to cover a service that for some reason cannot handle the header and POST methods?
Cheers,

Yavor

Your Connect2id Support Team

@jgrandja jgrandja added this to the 5.1.0.RC1 milestone Jul 24, 2018
@jgrandja jgrandja added the type: enhancement A general enhancement label Aug 14, 2018
@jgrandja
Copy link
Contributor

@XYUU This issue has been resolved. You will now have access to OAuth2AccessTokenResponse.additionalParameters in OAuth2UserRequest.additionalParameters.

Also, take a look at #5641 which will provide you the capability to customize the UserInfo request by overriding DefaultOAuth2UserService.buildRequest(). Alternatively, instead of extending/overriding, you can provide a RestOperations via DefaultOAuth2UserService.setRestOperations() and modify the outgoing request however you like using a ClientHttpRequestInterceptor.

This should give you the flexibility you need.

jgrandja pushed a commit that referenced this issue Mar 31, 2020
1. update OAuth2LoginAuthenticationProvider to use
OAuth2AuthorizationCodeAuthenticationProvider
2. apply fix gh-5368 for OAuth2AuthorizationCodeAuthenticationProvider
to return additionalParameters value from accessTokenResponse

Fixes gh-5633
jgrandja pushed a commit that referenced this issue Mar 31, 2020
1. update OAuth2LoginAuthenticationProvider to use
OAuth2AuthorizationCodeAuthenticationProvider
2. apply fix gh-5368 for OAuth2AuthorizationCodeAuthenticationProvider
to return additionalParameters value from accessTokenResponse

Fixes gh-5633
jgrandja pushed a commit that referenced this issue Mar 31, 2020
1. update OAuth2LoginAuthenticationProvider to use
OAuth2AuthorizationCodeAuthenticationProvider
2. apply fix gh-5368 for OAuth2AuthorizationCodeAuthenticationProvider
to return additionalParameters value from accessTokenResponse

Fixes gh-5633
jgrandja pushed a commit that referenced this issue Mar 31, 2020
1. update OAuth2LoginAuthenticationProvider to use
OAuth2AuthorizationCodeAuthenticationProvider
2. apply fix gh-5368 for OAuth2AuthorizationCodeAuthenticationProvider
to return additionalParameters value from accessTokenResponse

Fixes gh-5633
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants