You may want to have a look at the ACEGI tag libraries to help here:
http://www.acegisecurity.org/guide/springsecurity.html#taglib

Mike

On 1/11/08, Ding, Qin <[EMAIL PROTECTED]> wrote:
>
>  I modified error.jsp.  I have a requirement that admin can see the error
> message from the error stack on the page but not regular user, who only see
> the simple message.  Therefore, I need to have the access to the user
> object.  This is what I did:
>
>
>
> <%
>
>                 User user = null;
>
>
>
>                 if (SecurityContextHolder.getContext() != null) {
>
>                   SecurityContext sc = (SecurityContext)
> SecurityContextHolder.getContext();
>
>                   Authentication auth = sc.getAuthentication();
>
>                   if (auth != null) {
>
>                     user = (User) auth.getPrincipal();
>
>                   }
>
>                 }
>
>
>
>                 if (user != null && user.isAdmin()){ %>
>
>  ------
>
>
>
> <% } %>
>
> %>
>
>
>
>
>
> The problem is Authentication retrieved from securityContext is always
> null. Is Authentication object invalidated due to the error?
>
> How can I still get the access to the User object at this point?  Thank
> you.
>
>
>
> QD
>  ------------------------------
>
> *From:* Michael Horwitz [mailto:[EMAIL PROTECTED]
> *Sent:* Wednesday, January 09, 2008 11:17 AM
> *To:* users@appfuse.dev.java.net
> *Subject:* Re: [appfuse-user] Yikes Error Page
>
>
>
> Assuming you are using Struts with AppFuse 2.0.1 the page displayed on
> error is error.jsp. You can change the contents to be anything you like.
>
>
>
> Mike
>
>
> On 1/9/08, *Ding, Qin* <[EMAIL PROTECTED]> wrote:
>
> How can I replace "YIKES" error page with a user friendly message while
> logging "YIKES" error stack?  Or after logging the error, present the
> user with friendly page.  Thanks
>
> QD
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>

Reply via email to