Struts2 + Spring Security 2.06: Valuestack is null when attempting to use @Secured on an Action method

I just wonder, this problem occurs if you use the default configuration of Spring Security, where it expects ROLE_ prefixed names.

See this question:
How do I use custom roles/authorities in Spring Security?

You are using the default configuration witch expects that roles starts with the “ROLE_” prefix. You will have to add a custom security configuration and set rolePrefix to “”

The example configuration from: Spring Security Role Prefix and Custom User Details Service

<beans:bean id="roleVoter" class="org.springframework.security.access.vote.RoleVoter">
    <beans:property name="rolePrefix" value="" />
</beans:bean>

Related questions:

  • Spring Security ROLE_ prefix no longer needed?
  • Acegi Security: How do i add another GrantedAuthority to Authentication to anonymous user

Leave a Comment

tech