Closed jingweiz2017 closed 2 months ago
From this document, I understood OAuth2JWTBearer indeed requires a user token exchange. Can you help to explain "why ClientID and ClientSecret are still needed in destination with authentication being OAuth2JWTBearer?"
The OAuth2JWTBearer
needs both the credentials and the user information to create the JwT.
Therefore the destination needs the dwc-jwt
or dwc-ias-jwt
in the header.
_See: grant_type of JWT token_
Thanks for the sharing.
Issue Description
We had one destination configured under the subscriber's subaccount with its Authentication property set to 'OAuth2JWTBearer'. Once our application obtained that destination and used it for accessing a remote service, the Cloud SDK will try to do UserTokenExchange by first obtaining an auth token. Based on my understand, a destination with Authentication being 'OAuth2JWTBearer' doesn't require UserTokenExchange, but should use TECHNICAL_USER_CURRENT_TENANT or TECHNICAL_USER_PROVIDER instead depend on occasion.
Root Cause Analysis: After our application get the destination, the cloud sdk take “Authentication: OAuth2JWTBearer” in destination as a criteria to determine that this destination needs “user token exchange” (DestinationRetrievalStrategyResolver::doesDestinationConfigurationRequireUserTokenExchange). Because of that, it assign NAMED_USER_CURRENT_TENANT as token retrieve strategy which leads to dwc-jwt/dwc-ias-jwt auth token retrieval(DestinationRetrievalStrategyResolver #196). For OAuth2JWTBearer, it should go with TECHNICAL_USER_CURRENT_TENANT or TECHNICAL_USER_PROVIDER instead. I attached a screen shot of the destination, as well.
Function “DestinationRetrievalStrategyResolver::doesDestinationConfigurationRequireUserTokenExchange” return true on OAuth2JWTBearer is not correct. It should return false, so that behalfTechnicalUser(DestinationRetrievalStrategyResolver::resolveSingleRequestStrategy #78) get a chance to kick in.
Fix: I also prepared a fix for this issue based on the analysis above. Please let me know when to submit the PR.
Important information:
Impact / Priority
Affected development phase: Development
Impact: Blocked
Timeline: Not Specified
Error Message
We have upgrade to Cloud SDK 5.12
Project Details
Internal project and disclosure is not allowed.
Checklist