Announcement Announcement Module
Collapse
No announcement yet.
Spring Security 3.1 Java Configuration Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    This has already been discussed to some length in this thread

    Comment


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

      Comment

      Working...
      X