public PrincipalUser getRemoteUser ( HttpServletRequest req ) { requireArgument ( req != null , "Request cannot be null." ) ; if ( req . getHeader ( HttpHeaders . AUTHORIZATION ) != null ) { PrincipalUser result = null ; Object username = req . getAttribute ( AuthFilter . USER_ATTRIBUTE_NAME ) ; if ( username != null ) { result = userService . findUserByUsername ( String . class . cast ( username ) ) ; } return result ; } return null ; }
Returns the logged in user object .