wso2 / product-is

Welcome to the WSO2 Identity Server source code! For info on working with the WSO2 Identity Server repository and contributing code, click the link below.
http://wso2.github.io/
Apache License 2.0
748 stars 729 forks source link

user attributes are not returned in the token for device grant flow with identity federation #16051

Closed tharakawijekoon closed 1 year ago

tharakawijekoon commented 1 year ago

Describe the issue: When the device grant flow is set up to use a federated IDP for authentication, the user attributes returned from the federated IDP are not returned in the token(JWT access token and id token).

How to reproduce:

Expected behavior: The claims should be returned in the token even for federated users, provided that they are sent from the federated IDP and are added as requested claims in the service provider.

Analysis: The issue occurs because the user attributes are not cached against the device code as it is done with the code grant[2][3] and retrieved when building the token[4][5]

Environment information :

[1]https://is.docs.wso2.com/en/6.0.0/guides/access-delegation/try-device-flow/ [2]https://github.com/wso2-extensions/identity-inbound-auth-oauth/blob/42184c33eaf6dd6157e49fe230a85c2275e75a62/components/org.wso2.carbon.identity.oauth.endpoint/src/main/java/org/wso2/carbon/identity/oauth/endpoint/authz/OAuth2AuthzEndpoint.java#L1573 [3]https://github.com/wso2-extensions/identity-inbound-auth-oauth/blob/42184c33eaf6dd6157e49fe230a85c2275e75a62/components/org.wso2.carbon.identity.oauth.endpoint/src/main/java/org/wso2/carbon/identity/oauth/endpoint/authz/OAuth2AuthzEndpoint.java#LL1688C9-L1688C40 [4]https://github.com/wso2-extensions/identity-inbound-auth-oauth/blob/42184c33eaf6dd6157e49fe230a85c2275e75a62/components/org.wso2.carbon.identity.oauth/src/main/java/org/wso2/carbon/identity/openidconnect/DefaultOIDCClaimsCallbackHandler.java#L153 [5]https://github.com/wso2-extensions/identity-inbound-auth-oauth/blob/42184c33eaf6dd6157e49fe230a85c2275e75a62/components/org.wso2.carbon.identity.oauth/src/main/java/org/wso2/carbon/identity/openidconnect/DefaultOIDCClaimsCallbackHandler.java#L286

tharakawijekoon commented 1 year ago

Please test the refresh token flow as well after fixing the issue, the attributes should not be lost when using the refresh grant while the existing access token is active.

asha15 commented 1 year ago

Fixed with : https://github.com/wso2-extensions/identity-inbound-auth-oauth/pull/2129