Results 1 to 5 of 5

Thread: roo security show user details

  1. #1
    Join Date
    Nov 2009
    Posts
    28

    Default roo security show user details

    I know this is a dumb question, but I can't seem to figure out how to display the current logged in user in my roo generated application. Roles and authentication are working fine, just can't display any current user info.

    Can someone please show me how to do this?

    Many thanks!

  2. #2
    Join Date
    Nov 2009
    Posts
    28

    Default

    I figured it out by looking at the src/main/webapp/WEB-INF/layouts/default.jspx page.

    All I had to do was use: ${pageContext.request.userPrincipal.name}. See below for an example of how I am using it.

    <c:if test="${pageContext.request.userPrincipal != null}">
    <c:out value="&#160;|&#160;"/>
    <span>
    <spring:url var="logout" value="/static/j_spring_security_logout" />
    <a href="${logout}"><spring:message code="security.logout" /></a>
    Logged in as: ${pageContext.request.userPrincipal.name}
    </span>
    </c:if>

  3. #3
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    2,768

    Default

    Spring Security offers a taglib that can be used for this purpose: http://static.springsource.org/sprin...cationTag.html
    Ben Alex
    Project Founder, Spring UAA, Spring Roo and Spring Security

  4. #4
    Join Date
    Nov 2009
    Posts
    28

    Default

    Thanks. Ben.

    I tried to use the authz tag library but am still not able to get a working example. I am new to Spring Security so am learning as I go.

  5. #5
    Join Date
    Mar 2008
    Location
    Sydney, AU
    Posts
    974

    Default

    Without detailed information we will probably not be able to help you that much, but I am sure if you search the Spring Security forum or ask detailed questions there you can get this resolved quickly.

    Cheers,
    Stefan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •