Results 1 to 2 of 2

Thread: Help updating example from 2.x to 3.0.2

  1. #1

    Default Help updating example from 2.x to 3.0.2

    Hi all,
    I'm working on integrating spring security with Wicket. I'm following this tutorial here

    https://cwiki.apache.org/WICKET/spri...uth-roles.html

    However, it's a bit dated and I'm having a hard time transposing the example to the new version 3.0.2 security. Whenever I start my app and everything gets autowired, I receive this stack trace.

    Code:
    java.lang.IllegalStateException: more then one bean of type [org.springframework.security.authentication.AuthenticationManager] found, you have to specify the name of the bean (@SpringBean(name="foo")) in order to resolve this conflict. Matched beans: org.springframework.security.authentication.ProviderManager#0,org.springframework.security.authenticationManager
    Here is what I have, I've obviously fouled something up in my context configuration, I'm just not sure what. I haven't used Spring security since it was ACEGI, so help would be greatly appreciated.

    Version 2 context from tutorial

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:security="http://www.springframework.org/schema/security"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
           http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.4.xsd">
    
    	<bean id="myApplication" class="com.foo.bar.MyApplication" />
    
            <bean id="filterChainProxy" class="org.springframework.security.util.FilterChainProxy">
                <property name="filterInvocationDefinitionSource">
                    <value>
                        CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
                        PATTERN_TYPE_APACHE_ANT
                        /**=httpSessionContextIntegrationFilter
                    </value>
                </property>
            </bean>
    
            <bean id="httpSessionContextIntegrationFilter"
                  class="org.springframework.security.context.HttpSessionContextIntegrationFilter">
                <property name="allowSessionCreation" value="false"/>
            </bean>
    
    	<security:authentication-provider>
    		<security:user-service>
    			<security:user password="admin" name="admin" authorities="ROLE_ADMIN" />
    		</security:user-service>
    	</security:authentication-provider>
    
    </beans>
    Here is what I have for my version 3 context. Note I've added a user and a ROLE_USER as well to test it out with the in memory provider before I create my own auth provider.

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:security="http://www.springframework.org/schema/security"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
    	http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd">
    
    	
    	<security:http create-session="never" auto-config="true">
    		<security:remember-me/>
    		<security:intercept-url pattern="/**"/>
    	</security:http>
    
    
    	<security:authentication-manager>
    		<security:authentication-provider>
    
    			<!--  TODO change this to reference our real user service -->
    			<security:user-service>
    				<security:user name="admin" password="admin"
    					authorities="ROLE_ADMIN, ROLE_USER" />
    				<security:user name="user" password="user"
    					authorities="ROLE_USER" />
    
    			</security:user-service>
    		</security:authentication-provider>
    
    	</security:authentication-manager>
    
    	<security:global-method-security
    		secured-annotations="enabled" />
    </beans>
    Thanks in advance!

    Todd

  2. #2

    Default

    Just in case anyone else reads this. I've solved the problem. I needed to alias the security config and use the name in the spring bean. I've updated the wiki.

Posting Permissions

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