Results 1 to 3 of 3

Thread: Security Authorities/Roles list comes as empty on anonymous login . Why?

Hybrid View

  1. #1
    Join Date
    Jun 2012
    Posts
    9

    Default Security Authorities/Roles list comes as empty on anonymous login . Why?

    Hello,

    I'm a newbie to Spring Security. Here's a problem I ran across:

    Within my welcome/login jsp page I'm printing out the current role of the user (anonymous guest) who just got to this page:


    <security:authentication property="authorities" var="authorities" />
    <ul> <c:forEach items="${authorities}" var="authority">
    <li>${authority.authority}</li>
    </c:forEach>
    </ul>

    When I start my browser fresh (i.e. with all the cookies/browsing history cleaned up) the list correctly contains ROLE_GUEST item. However, when I access page for the second (and subsequent) times - the list comes as empty.

    Can anyone explain why?

    Thank you so much,

    Dima

  2. #2
    Join Date
    Jan 2008
    Posts
    1,834

    Default

    Are you utilizing security=none or filters=none? If so, Spring Security will not be enabled for those URLs and thus there will be no GrantedAuthorities.
    Rob Winch
    Twitter @rob_winch
    Spring Security Lead
    Spring by Pivotal

  3. #3
    Join Date
    Jun 2012
    Posts
    9

    Default

    Rob,

    Thank you so much, that was it!

    Dima

Tags for this Thread

Posting Permissions

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