OAuth2 Provider User Name

In many uses cases for API’s, the authenticated user id (or user name) is required in order to determine further access rights to resources controlled by the API.  The Anypoint Platform API OAuth2 Provider policy provides user authentication which can be captured by the API proxy and passed along to the API implementations.  To pass a “user_id” property on to the API implementation from the proxy, edit the proxy generated by the API Platform and insert the following property component:

<set-property propertyName="user_id"
  value="#[flowVars['mule.oauth2.access_token_store_holder'].resourceOwnerAuthentication.principal.username]"
doc:name="Add user_id" />
Advertisements