Results 1 to 3 of 3

Thread: Spring Security 3.1 Java Configuration

  1. #1

    Default Spring Security 3.1 Java Configuration

    I have a configuration xml file of my spring security, but would love to convert my xml configuration to Java, since my other Spring related configuration is in Java too.

    Can anyone give me a hint or a link to an example?

    My xml configuration looks like this:
    HTML Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans:beans xmlns="http://www.springframework.org/schema/security"
        xmlns:beans="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
                            http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd">
    
        <debug />
    
        <global-method-security pre-post-annotations="enabled" />
    
        <http use-expressions="true">
        	<intercept-url pattern="/account/**" access="hasRole('ROLE_USER')" />
    		
    		<form-login login-page="/auth/login" 
    					authentication-failure-url="/auth/denied" 
    					default-target-url="/contact/feedback" />
    
    		<access-denied-handler error-page="/auth/denied" />
    
    		<logout invalidate-session="true"
    				logout-success-url="/auth/logout"
    				logout-url="/logout"
    				delete-cookies="JSESSIONID" />
    				
            <remember-me />
            
            <!-- Uncomment to limit the number of sessions a user can have -->
            <session-management invalid-session-url="/">
                <concurrency-control max-sessions="1" error-if-maximum-exceeded="true" />
            </session-management>
    
        </http>
    
    	<beans:bean id="passwordEncoder" class="org.springframework.security.authentication.encoding.Md5PasswordEncoder" />    
    	<authentication-manager>
    		<authentication-provider user-service-ref="customUserDetailsService">
    			<password-encoder ref="passwordEncoder"/>
    		</authentication-provider>
    	</authentication-manager>
    	
    
    </beans:beans>
    I would appreciate any help.

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

    Default

    This has already been discussed to some length in this thread
    Rob Winch - @rob_winch
    Spring Security Lead
    Pivotal

  3. #3

    Default

    Thanks for the hint. It's a pitty that Java config is not supported yet.

Posting Permissions

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