Announcement Announcement Module
Collapse
No announcement yet.
Granted authorities format exception Page Title Module
Move Remove Collapse
This topic is closed
X
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Granted authorities format exception

    My application have following type of roles assigned to users

    CLIENT_MANAGING_BUSINESS
    BUSIENSS_SERVICES_SUPERVISOR
    CLIENT_EQUIRY_SERVICES

    configuring these in applicationcontext file gives

    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'securityEnforcementFilter' defined in ServletContext resource [/WEB-INF/applicationContext-acegi.xml]: Can't resolve reference to bean 'filterInvocationInterceptor' while setting property 'filterSecurityInterceptor'; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'filterInvocationInterceptor' defined in ServletContext resource [/WEB-INF/applicationContext-acegi.xml]: Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: Unsupported configuration attributes: [RROLE_Administrator]
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'filterInvocationInterceptor' defined in ServletContext resource [/WEB-INF/applicationContext-acegi.xml]: Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: Unsupported configuration attributes: [RROLE_Administrator]
    java.lang.IllegalArgumentException: Unsupported configuration attributes: [CLIENT_MANAGING_BUSINESS,BUSIENSS_SERVICES_SUPERVI SOR]
    at net.sf.acegisecurity.intercept.AbstractSecurityInt erceptor.afterPropertiesSet(AbstractSecurityInterc eptor.java:314)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:1058)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:363)
    at org.springframework.beans.factory.support.Abstract BeanFactory.

  • #2
    Hi Vishal

    RoleVoter will only vote for roles that start with "ROLE_".

    So at startup time the AbstractSecurityInterceptor is checking that each of the configuration attributes defined against the objectDefinitionSource are supported. Because RoleVoter doesn't think it should vote for, say, CLIENT_EQUIRY_SERVICE, it will not support it. As no other AccessDecisionVoters will support it, the startup fails.

    Solution: Modify your role names to have the ROLE_ prefix. Or, set RoleVoter.rolePrefix to an empty String.

    Comment


    • #3
      Thanks Ben!

      I prefixed my role names with ROLE_ while retrieving from the database for now. I will try Rolevoter.setPrefix once I get everything working

      Comment


      • #4
        rolePrefix in Rolevoter worked too

        <!-- An access decision voter that reads ROLE_* configuration settings -->
        <bean id="roleVoter" class="org.acegisecurity.vote.RoleVoter">
        <property name = "rolePrefix" value = "" />
        </bean>

        Comment

        Working...
        X