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
Leave a comment

Comments

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: