diff --git a/core/src/main/resources/org/springframework/security/config/spring-security-2.0.rnc b/core/src/main/resources/org/springframework/security/config/spring-security-2.0.rnc index 6f4a2467d5..8c46dd6f72 100644 --- a/core/src/main/resources/org/springframework/security/config/spring-security-2.0.rnc +++ b/core/src/main/resources/org/springframework/security/config/spring-security-2.0.rnc @@ -405,7 +405,9 @@ user.attlist &= user.attlist &= ## Can be set to "true" to mark an account as locked and unusable. attribute locked {boolean}? - +user.attlist &= + ## Can be set to "true" to mark an account as disabled and unusable. + attribute disabled {boolean}? jdbc-user-service = ## Causes creation of a JDBC-based UserDetailsService. diff --git a/core/src/main/resources/org/springframework/security/config/spring-security-2.0.xsd b/core/src/main/resources/org/springframework/security/config/spring-security-2.0.xsd index d0a35c376a..f1dd38fa30 100644 --- a/core/src/main/resources/org/springframework/security/config/spring-security-2.0.xsd +++ b/core/src/main/resources/org/springframework/security/config/spring-security-2.0.xsd @@ -1116,6 +1116,12 @@ unusable. + + + Can be set to "true" to mark an account as disabled and + unusable. + + diff --git a/core/src/test/java/org/springframework/security/config/UserServiceBeanDefinitionParserTests.java b/core/src/test/java/org/springframework/security/config/UserServiceBeanDefinitionParserTests.java index cdc687c561..d7da239da3 100644 --- a/core/src/test/java/org/springframework/security/config/UserServiceBeanDefinitionParserTests.java +++ b/core/src/test/java/org/springframework/security/config/UserServiceBeanDefinitionParserTests.java @@ -1,6 +1,9 @@ package org.springframework.security.config; +import static org.junit.Assert.*; + import org.springframework.security.util.InMemoryXmlApplicationContext; +import org.springframework.security.userdetails.UserDetails; import org.springframework.security.userdetails.UserDetailsService; import org.springframework.context.support.AbstractXmlApplicationContext; import org.springframework.beans.FatalBeanException; @@ -42,6 +45,21 @@ public class UserServiceBeanDefinitionParserTests { userService.loadUserByUsername("joe"); } + @Test + public void disabledAndEmbeddedFlagsAreSupported() { + setContext( + "" + + " " + + " " + + ""); + UserDetailsService userService = (UserDetailsService) appContext.getBean("service"); + UserDetails joe = userService.loadUserByUsername("joe"); + assertFalse(joe.isAccountNonLocked()); + UserDetails bob = userService.loadUserByUsername("bob"); + assertFalse(bob.isEnabled()); + } + + @Test(expected=FatalBeanException.class) public void userWithBothPropertiesAndEmbeddedUsersThrowsException() { setContext(