After checking the output of ApiManager debugging, I noticed that user sequences are executed immediately after the handlers. Fortunately, the OAuthAuthenticator class (used by APIAuthenticationHandler) sets some convenient properties, such as END_USER_NAME and APPLICATION_NAME .
END_USER_NAME contains the name and tenant of the caller ( user@tenant.com ).
This custom sequence worked for me:
<sequence name="add_service_header" trace="enable" statistics="enable" xmlns="http://ws.apache.org/ns/synapse"> <log/> <property name="tenant" expression="fn:substring-after(get-property('END_USER_NAME'), '@')" /> <header name="X-Tenant" scope="transport" expression="get-property('tenant')"/> <header name="X-AppName" scope="transport" expression="get-property('APPLICATION_NAME')"/> </sequence>
I could not find the documentation for a property other than the source code, and this other question
Marcos sánchez
source share