We have an web app what uses Basic HTTP authentication.
web.xml
...
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>file</realm-name>
</login-config>
...
Indirect usage somewhere in the deep code space …
User getLogedUser(HttpServletRequest request)
And I have to rewrite it in JSF 2, but I have no clue how can use the this authentication method in JSF 2. (i could not find the way how can i get ‘HttpServletRequest request’)
Google did not throw any useful hit on his first page
Thanks for the answers in advance.
The raw
HttpServletRequestis in JSF available byExternalContext#getRequest().However, I think it’s better to change the
getLoggedUser()method to take the remote user instead.so that you can just feed either
ExternalContext#getRemoteUser()orHttpServletRequest#getRemoteUser()to it. This also decouples the method from any Servlet API or JSF API dependency.