I have defined a UserLogin security check extending the UserAuthenticationSecurityCheck class
. Once the user is authenticated I need to set some attributes when creating the user in the protected AuthenticatedUser createUser()
function in order to use them later as headers in my Java Adapter.
My problem is that I'm not able to get the Active User information from my adapter resource secured by @OAuthSecurity(scope = "UserLogin")
.
I have tried defining in my securitycheck the following function:
public AuthenticatedUser getUser() {
return authorizationContext.getActiveUser();
}
and then calling it on this way from the adapter:
UserLogin userLogin;
logger.info("Logging info message..."+userLogin.getUser().getId());
But it returns a null pointer exception.
How am I suppose to get active user information from Java Adapters?