1
0
mirror of synced 2026-08-06 02:08:01 +00:00

SEC-777: The disabled status cannot be set in <user-service>

http://jira.springframework.org/browse/SEC-777. Added the disabled flag to the relax grammar file.
This commit is contained in:
Luke Taylor
2008-04-21 15:59:08 +00:00
parent 993fdd7a32
commit 5bb558bd6a
3 changed files with 27 additions and 1 deletions
@@ -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(
"<user-service id='service'>" +
" <user name='joe' password='joespassword' authorities='ROLE_A' locked='true'/>" +
" <user name='bob' password='bobspassword' authorities='ROLE_A' disabled='true'/>" +
"</user-service>");
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(