SEC-1312: Add detection of 2.0 schemas. Added check to SecurityNamespaceHandler and reinstated old schemas.

This commit is contained in:
Luke Taylor
2009-12-06 21:15:11 +00:00
parent ab48d72cc2
commit d4e4a09801
7 changed files with 5613 additions and 15 deletions

View File

@@ -0,0 +1,30 @@
package org.springframework.security.config;
import static org.junit.Assert.*;
import org.junit.Test;
import org.springframework.beans.factory.parsing.BeanDefinitionParsingException;
import org.springframework.security.config.util.InMemoryXmlApplicationContext;
/**
*
* @author Luke Taylor
* @version $Id$
* @since 3.0
*/
public class SecurityNamespacehandlerTests {
@Test
public void pre3SchemaAreNotSupported() throws Exception {
try {
new InMemoryXmlApplicationContext(
"<user-service id='us'>" +
" <user name='bob' password='bobspassword' authorities='ROLE_A' />" +
"</user-service>", "2.0.4", null
);
fail("Expected BeanDefinitionParsingException");
} catch (BeanDefinitionParsingException expected) {
assertTrue(expected.getMessage().contains("You cannot use a spring-security-2.0.xsd schema"));
}
}
}