Search code examples
ibm-mobilefirstmobilefirst-adaptersmobilefirst-server

MobileFirst 8: get client data ( IP address, request data ) in UserAuthenticationSecurityCheck


I'm trying to get some client data inside the UserAuthenticationSecurityCheck.validateCredentials method.

The IP Address is the most important for it.

In the other adapters, I'm using the HttpServletRequest:

@Context
protected HttpServletRequest request;

But this request object is always null in the UserAuthenticationSecurityCheck.

How can I get client data (IP Address or the headers) in this class?


Solution

  • You cannot inject the HttpServletRequest into a security check object(by design - not a bug). Once the user is authenticated, then you can make another Adapter Call, from where you can get the desired details. Unfortunately this is not documented anywhere (not to my knowledge at least).

    I had a similar issue with AdapterAPI class as described here.