Hi all,
Is there an elegant way to access information about username and possibly roles assigned to him using EL expressions??
In my JSPs I use conditionals to display different page contents to different users. The best solution to me would be something like this...
<c:choose>
<c:when test="${sessionScope.remoteUser==null}">
page content for user that has not logged in yet...
</c:when>
<c
therwise>
Hello <c
ut value="${sessionScope.remoteUser}"/> etc...
</c
therwise>
</c:choose>
However the problem is that there is no sessionScope.remoteUser after the user has logged in (I know requestScope.remoteUser looks like it might work but it does not).
To make the above
JSP work, a following scriptlet must be added before the JSTL conditionals:
<%
String user = request.getRemoteUser();
if(user!=null && request.getSession(false)!=null && session.getAttribute("remoteUser")==null)
session.setAttribute("remoteUser", user);
%>
How can I achieve my goal without that scriptlet??
Again the finnset solution would be if the code setting the remoteUser attribute ran only once, just after the user has successfuly loged in.
Is there a way to intercept the authentication procedure and smuggle some custom code there (for now I use form based authentication with
JDBC Realm configured) ??
Thanx in advance for your suggestions.
Regards
Chris