I have a WSO2 ESB WSDL based proxy service which is secured with UsernameToken scenario. This wrapper service is for an Axis2 back-end web service deployed as an .aar file in the WSO2 Application Server. What I want is to retrieve the username used for the authentication in the back-end service.
I tried to get the username using the below Java code, but it always comes back NULL
:
MessageContext msgContext = MessageContext.getCurrentMessageContext();
String username = (String)msgContext.getProperty(RampartMessageData.USERNAME);
It seems that the MessageContext
does not store the Rampart message data. Is there anything I can set in the WSO2 ESB to have that username be passed to the back-end service in the message context?
Thank you!