FYI, I've entered http://issues.apache.org/jira/browse/BEEHIVE-941 for this.
Rich Feit wrote:
>Hi Adam,
>
>If you're using container-managed login, something like this should work:
>
> <c:if test="${pageContext.request.userPrincipal != null}">
> ...
> </c:if>
>
>However, if you've overridden the default login behavior using your own
>LoginHandler, there isn't a very discoverable way to do this. I think
>what we need are protected getUserPrincipal() and isUserInRole() on
>FlowController, which would be aware of the login-override mechanism.
>In the meantime, you should be able to get what you need by passing the
>following value to your JSP as a page input (or exposing it however you
>normally expose data to your pages):
>
> FlowControllerHandlerContext fcContext = new
>FlowControllerHandlerContext(getRequest(), getResponse(), this);
> boolean loggedIn =
>(Handlers.get(getServletContext()).getLoginHandler().getUserPrincipal(fcContext)
>!= null);
>
>I'll open a bug on the missing API; meanwhile, if you have any
>problems/questions about this, let me know.
>
>Rich
>
>
>Adam Jenkins wrote:
>
>
>
>>Hi Guys,
>>
>>I'm having difficulty figuring out a way to conditionally show anchors
>>and other html artifacts based on whether a user is logged in or not.
>>Is there an 'isLoggedIn' method anywhere accessible from a jsp? I had a
>>look at the javadoc but couldn't track it down.
>>
>>Cheers
>>Adam
>>
>>
>>
>>
>>
>>
>
>
>