Announcement Announcement Module
Collapse
No announcement yet.
Security Authorities/Roles list comes as empty on anonymous login . Why? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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.

    Comment


    • #3
      Rob,

      Thank you so much, that was it!

      Dima

      Comment

      Working...
      X