0

Is there a way we can retrieve the username of the user that is in Basic Auth? Get the username of the basic auth and save inside a property to use it in API Manager Logic

Thanks

I have done it before with MI and WWSecurity but not with APIM and Basic auth

1 Answers1

0

I don't think you cannot achieve this via a simple mediation sequence as we record the username field inside the authenticationContext object.

However with a customer handler or a custom class mediator, you can access this object from java. You can get this object from the synapse context via (AuthenticationContext) synCtx.getProperty("__API_AUTH_CONTEXT"). Here is an example of this object returned in the throttle handler. You can use the getter getUsername() to get the username of the requester and set this as a syapse property.

Lakshitha
  • 1,021
  • 1
  • 6
  • 15