diff --git a/core/src/main/java/org/springframework/security/config/HttpSecurityBeanDefinitionParser.java b/core/src/main/java/org/springframework/security/config/HttpSecurityBeanDefinitionParser.java new file mode 100644 index 0000000000..df1922e4cb --- /dev/null +++ b/core/src/main/java/org/springframework/security/config/HttpSecurityBeanDefinitionParser.java @@ -0,0 +1,214 @@ +package org.springframework.security.config; + +import org.springframework.beans.factory.xml.ParserContext; +import org.springframework.beans.factory.xml.BeanDefinitionParser; +import org.springframework.beans.factory.support.RootBeanDefinition; +import org.springframework.beans.factory.support.BeanDefinitionBuilder; +import org.springframework.beans.factory.support.BeanDefinitionRegistry; +import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.util.xml.DomUtils; +import org.springframework.util.Assert; +import org.springframework.util.StringUtils; +import org.springframework.security.util.FilterChainProxy; +import org.springframework.security.intercept.web.PathBasedFilterInvocationDefinitionMap; +import org.springframework.security.intercept.web.FilterSecurityInterceptor; +import org.springframework.security.intercept.web.FilterInvocationDefinitionMap; +import org.springframework.security.ConfigAttributeEditor; +import org.springframework.security.ConfigAttributeDefinition; +import org.springframework.security.ui.ExceptionTranslationFilter; +import org.springframework.security.ui.webapp.AuthenticationProcessingFilter; +import org.springframework.security.ui.webapp.AuthenticationProcessingFilterEntryPoint; +import org.springframework.security.context.HttpSessionContextIntegrationFilter; +import org.w3c.dom.Element; + +import java.util.List; +import java.util.Iterator; + +/** + * Sets up HTTP security: filter stack and protected URLs. + * + * + * @author luke + * @version $Id$ + */ +public class HttpSecurityBeanDefinitionParser implements BeanDefinitionParser { + + public static final String DEFAULT_FILTER_CHAIN_PROXY_ID = "_filterChainProxy"; + + public static final String DEFAULT_HTTP_SESSION_FILTER_ID = "_httpSessionContextIntegrationFilter"; + public static final String DEFAULT_LOGOUT_FILTER_ID = "_logoutFilter"; + public static final String DEFAULT_EXCEPTION_TRANSLATION_FILTER_ID = "_exceptionTranslationFilter"; + public static final String DEFAULT_FILTER_SECURITY_INTERCEPTOR_ID = "_filterSecurityInterceptor"; + public static final String DEFAULT_FORM_LOGIN_FILTER_ID = "_formLoginFilter"; + public static final String DEFAULT_FORM_LOGIN_ENTRY_POINT_ID = "_formLoginEntryPoint"; + + public static final String LOGOUT_ELEMENT = "logout"; + public static final String FORM_LOGIN_ELEMENT = "form-login"; + + private static final String PATH_ATTRIBUTE = "path"; + private static final String FILTERS_ATTRIBUTE = "filters"; + private static final String ACCESS_CONFIG_ATTRIBUTE = "access"; + + private static final String LOGIN_URL_ATTRIBUTE = "loginUrl"; + + private static final String FORM_LOGIN_TARGET_URL_ATTRIBUTE = "defaultTargetUrl"; + private static final String DEFAULT_FORM_LOGIN_TARGET_URL = "/index"; + + private static final String FORM_LOGIN_AUTH_FAILURE_URL_ATTRIBUTE = "defaultTargetUrl"; + // TODO: Change AbstractProcessingFilter to not need a failure URL and just write a failure message + // to the response if one isn't set. + private static final String DEFAULT_FORM_LOGIN_AUTH_FAILURE_URL = "/loginError"; + + public BeanDefinition parse(Element element, ParserContext parserContext) { + // Create HttpSCIF, FilterInvocationInterceptor, ExceptionTranslationFilter + + // Find other filter beans. + + // Create appropriate bean list for config attributes to create FIDS + + // Add any secure URLs with specific filter chains to FIDS as separate ConfigAttributes + + // Add secure URLS with roles to objectDefinitionSource for FilterSecurityInterceptor + + RootBeanDefinition filterChainProxy = new RootBeanDefinition(FilterChainProxy.class); + + RootBeanDefinition httpSCIF = new RootBeanDefinition(HttpSessionContextIntegrationFilter.class); + + //TODO: Set session creation parameters based on session-creation attribute + + BeanDefinitionBuilder filterSecurityInterceptorBuilder + = BeanDefinitionBuilder.rootBeanDefinition(FilterSecurityInterceptor.class); + + + BeanDefinitionBuilder exceptionTranslationFilterBuilder + = BeanDefinitionBuilder.rootBeanDefinition(ExceptionTranslationFilter.class); + + // Autowire for entry point (for now) + exceptionTranslationFilterBuilder.setAutowireMode(RootBeanDefinition.AUTOWIRE_BY_TYPE); + + // TODO: Get path type attribute and determine FilDefInvS class + PathBasedFilterInvocationDefinitionMap filterChainInvocationDefSource + = new PathBasedFilterInvocationDefinitionMap(); + + filterChainProxy.getPropertyValues().addPropertyValue("filterInvocationDefinitionSource", + filterChainInvocationDefSource); + + PathBasedFilterInvocationDefinitionMap interceptorFilterInvDefSource + = new PathBasedFilterInvocationDefinitionMap(); + + filterSecurityInterceptorBuilder.addPropertyValue("objectDefinitionSource", interceptorFilterInvDefSource); + + // Again pick up auth manager + filterSecurityInterceptorBuilder.setAutowireMode(RootBeanDefinition.AUTOWIRE_BY_TYPE); + + parseInterceptUrls(DomUtils.getChildElementsByTagName(element, "intercept-url"), + filterChainInvocationDefSource, interceptorFilterInvDefSource); + // TODO: if empty, set a default set a default /**, omitting login url + + BeanDefinitionRegistry registry = parserContext.getRegistry(); + + Element logoutElt = DomUtils.getChildElementByTagName(element, LOGOUT_ELEMENT); + + if (logoutElt != null) { + BeanDefinition logoutFilter = new LogoutBeanDefinitionParser().parse(logoutElt, parserContext); + } + + Element formLoginElt = DomUtils.getChildElementByTagName(element, FORM_LOGIN_ELEMENT); + + if (formLoginElt != null) { + BeanDefinitionBuilder formLoginFilterBuilder = + BeanDefinitionBuilder.rootBeanDefinition(AuthenticationProcessingFilter.class); + BeanDefinitionBuilder formLoginEntryPointBuilder = + BeanDefinitionBuilder.rootBeanDefinition(AuthenticationProcessingFilterEntryPoint.class); + + // Temporary login value + formLoginEntryPointBuilder.addPropertyValue("loginFormUrl", "/login"); + + + String loginUrl = formLoginElt.getAttribute(LOGIN_URL_ATTRIBUTE); + + if (StringUtils.hasText(loginUrl)) { + formLoginFilterBuilder.addPropertyValue("filterProcessesUrl", loginUrl); + } + + String defaultTargetUrl = formLoginElt.getAttribute(FORM_LOGIN_TARGET_URL_ATTRIBUTE); + + if (!StringUtils.hasText(defaultTargetUrl)) { + defaultTargetUrl = DEFAULT_FORM_LOGIN_TARGET_URL; + } + + formLoginFilterBuilder.addPropertyValue("defaultTargetUrl", defaultTargetUrl); + + String authenticationFailureUrl = formLoginElt.getAttribute(FORM_LOGIN_AUTH_FAILURE_URL_ATTRIBUTE); + + if (!StringUtils.hasText(authenticationFailureUrl)) { + authenticationFailureUrl = DEFAULT_FORM_LOGIN_AUTH_FAILURE_URL; + } + + formLoginFilterBuilder.addPropertyValue("authenticationFailureUrl", authenticationFailureUrl); + // Set autowire to pick up the authentication manager. + formLoginFilterBuilder.setAutowireMode(RootBeanDefinition.AUTOWIRE_BY_TYPE); + + + registry.registerBeanDefinition(DEFAULT_FORM_LOGIN_FILTER_ID, + formLoginFilterBuilder.getBeanDefinition()); + registry.registerBeanDefinition(DEFAULT_FORM_LOGIN_ENTRY_POINT_ID, + formLoginEntryPointBuilder.getBeanDefinition()); + } + + registry.registerBeanDefinition(DEFAULT_FILTER_CHAIN_PROXY_ID, filterChainProxy); + registry.registerBeanDefinition(DEFAULT_HTTP_SESSION_FILTER_ID, httpSCIF); + registry.registerBeanDefinition(DEFAULT_EXCEPTION_TRANSLATION_FILTER_ID, + exceptionTranslationFilterBuilder.getBeanDefinition()); + registry.registerBeanDefinition(DEFAULT_FILTER_SECURITY_INTERCEPTOR_ID, + filterSecurityInterceptorBuilder.getBeanDefinition()); + + + // Register the post processor which will tie up the loose ends in the configuration once the + // app context has been created and all beans are available. + + registry.registerBeanDefinition("__httpConfigBeanFactoryPostProcessor", + new RootBeanDefinition(HttpSecurityConfigPostProcessor.class)); + + return null; + } + + /** + * Parses the intercept-url elements and populates the FilterChainProxy's FilterInvocationDefinitionSource + */ + private void parseInterceptUrls(List urlElts, FilterInvocationDefinitionMap filterChainInvocationDefSource, + FilterInvocationDefinitionMap interceptorFilterInvDefSource) { + + Iterator urlEltsIterator = urlElts.iterator(); + + ConfigAttributeEditor attributeEditor = new ConfigAttributeEditor(); + + while (urlEltsIterator.hasNext()) { + Element urlElt = (Element) urlEltsIterator.next(); + + String path = urlElt.getAttribute(PATH_ATTRIBUTE); + + Assert.hasText(path, "path attribute cannot be empty or null"); + + String access = urlElt.getAttribute(ACCESS_CONFIG_ATTRIBUTE); + + // Convert the comma-separated list of access attributes to a ConfigAttributeDefinition + if (StringUtils.hasText(access)) { + attributeEditor.setAsText(access); + + ConfigAttributeDefinition attributeDef = (ConfigAttributeDefinition) attributeEditor.getValue(); + + interceptorFilterInvDefSource.addSecureUrl(path, attributeDef); + } + + String filters = urlElt.getAttribute(FILTERS_ATTRIBUTE); + + if (StringUtils.hasText(filters)) { + attributeEditor.setAsText(filters); + } + + + + } + } +} diff --git a/core/src/main/java/org/springframework/security/config/HttpSecurityConfigPostProcessor.java b/core/src/main/java/org/springframework/security/config/HttpSecurityConfigPostProcessor.java new file mode 100644 index 0000000000..fe2a09dc07 --- /dev/null +++ b/core/src/main/java/org/springframework/security/config/HttpSecurityConfigPostProcessor.java @@ -0,0 +1,59 @@ +package org.springframework.security.config; + +import org.springframework.beans.factory.config.BeanFactoryPostProcessor; +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; +import org.springframework.beans.BeansException; +import org.springframework.security.util.FilterChainProxy; +import org.springframework.security.context.HttpSessionContextIntegrationFilter; +import org.springframework.security.AuthenticationManager; +import org.springframework.util.Assert; + +import javax.servlet.Filter; +import java.util.Map; + +/** + * Responsible for tying up the HTTP security configuration - building ordered filter stack and linking up + * with other beans. + * + * @author Luke Taylor + * @version $Id$ + */ +public class HttpSecurityConfigPostProcessor implements BeanFactoryPostProcessor { + public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { + FilterChainProxy filterChainProxy = + (FilterChainProxy) beanFactory.getBean(HttpSecurityBeanDefinitionParser.DEFAULT_FILTER_CHAIN_PROXY_ID); + + HttpSessionContextIntegrationFilter httpSCIF = (HttpSessionContextIntegrationFilter) + beanFactory.getBean(HttpSecurityBeanDefinitionParser.DEFAULT_HTTP_SESSION_FILTER_ID); + + AuthenticationManager authManager = + (AuthenticationManager) getBeanOfType(AuthenticationManager.class, beanFactory); + + + // + Map filters = beanFactory.getBeansOfType(Filter.class); + + + + + + + + + } + + private void configureFilterChain(ConfigurableListableBeanFactory beanFactory) { + + + } + + + + private Object getBeanOfType(Class clazz, ConfigurableListableBeanFactory beanFactory) { + Map beans = beanFactory.getBeansOfType(clazz); + + Assert.isTrue(beans.size() == 1, "Required a single bean of type " + clazz + " but found " + beans.size()); + + return beans.values().toArray()[0]; + } +} diff --git a/core/src/main/java/org/springframework/security/config/InterceptMethodsBeanDefinitionDecorator.java b/core/src/main/java/org/springframework/security/config/InterceptMethodsBeanDefinitionDecorator.java new file mode 100644 index 0000000000..4df0a14741 --- /dev/null +++ b/core/src/main/java/org/springframework/security/config/InterceptMethodsBeanDefinitionDecorator.java @@ -0,0 +1,57 @@ +package org.springframework.security.config; + +import org.springframework.aop.config.AbstractInterceptorDrivenBeanDefinitionDecorator; +import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.beans.factory.support.RootBeanDefinition; +import org.springframework.security.intercept.method.aopalliance.MethodSecurityInterceptor; +import org.springframework.security.intercept.method.MethodDefinitionMap; +import org.springframework.security.ConfigAttributeEditor; +import org.springframework.security.ConfigAttributeDefinition; +import org.springframework.util.xml.DomUtils; +import org.w3c.dom.Node; +import org.w3c.dom.Element; + +import java.util.List; +import java.util.Iterator; + +/** + * @author luke + * @version $Id$ + */ +public class InterceptMethodsBeanDefinitionDecorator extends AbstractInterceptorDrivenBeanDefinitionDecorator { + protected BeanDefinition createInterceptorDefinition(Node node) { + Element interceptMethodsElt = (Element)node; + RootBeanDefinition interceptor = new RootBeanDefinition(MethodSecurityInterceptor.class); + + Element beanNode = (Element)interceptMethodsElt.getParentNode(); + // Get the class from the parent bean... + String targetClassName = beanNode.getAttribute("class"); + Class targetClass; + + try { + targetClass = Thread.currentThread().getContextClassLoader().loadClass(targetClassName); + } catch (ClassNotFoundException e) { + throw new IllegalArgumentException("Couldn't load class " + targetClassName, e); + } + + // Parse the included methods + List methods = DomUtils.getChildElementsByTagName(interceptMethodsElt, "protect"); + MethodDefinitionMap methodMap = new MethodDefinitionMap(); + ConfigAttributeEditor attributeEditor = new ConfigAttributeEditor(); + + for (Iterator i = methods.iterator(); i.hasNext();) { + Element protectmethodElt = (Element) i.next(); + String accessConfig = protectmethodElt.getAttribute("access"); + attributeEditor.setAsText(accessConfig); + + methodMap.addSecureMethod(targetClass, protectmethodElt.getAttribute("method"), + (ConfigAttributeDefinition) attributeEditor.getValue()); + } + + interceptor.getPropertyValues().addPropertyValue("objectDefinitionSource", methodMap); + + interceptor.setAutowireMode(RootBeanDefinition.AUTOWIRE_BY_TYPE); + + return interceptor; + } +} diff --git a/core/src/main/java/org/springframework/security/config/LdapBeanDefinitionParser.java b/core/src/main/java/org/springframework/security/config/LdapBeanDefinitionParser.java index 0b5b48a5a1..92161d9b2a 100644 --- a/core/src/main/java/org/springframework/security/config/LdapBeanDefinitionParser.java +++ b/core/src/main/java/org/springframework/security/config/LdapBeanDefinitionParser.java @@ -51,11 +51,8 @@ public class LdapBeanDefinitionParser extends AbstractBeanDefinitionParser { // Defaults private static final String DEFAULT_ROOT_SUFFIX = "dc=springframework,dc=org"; - - private static final String DEFAULT_PROVIDER_BEAN_ID = "_ldapProvider"; - + private static final String DEFAULT_PROVIDER_BEAN_ID = "_ldapAuthenticationProvider"; private static final String DEFAULT_DN_PATTERN = "uid={0},ou=people"; - private static final String DEFAULT_GROUP_CONTEXT = "ou=groups"; diff --git a/core/src/main/java/org/springframework/security/config/LogoutBeanDefinitionParser.java b/core/src/main/java/org/springframework/security/config/LogoutBeanDefinitionParser.java new file mode 100644 index 0000000000..bd7ec5c00a --- /dev/null +++ b/core/src/main/java/org/springframework/security/config/LogoutBeanDefinitionParser.java @@ -0,0 +1,51 @@ +package org.springframework.security.config; + +import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser; +import org.springframework.beans.factory.xml.ParserContext; +import org.springframework.beans.factory.support.BeanDefinitionBuilder; +import org.springframework.beans.factory.support.AbstractBeanDefinition; +import org.springframework.beans.factory.BeanDefinitionStoreException; +import org.springframework.security.ui.logout.LogoutFilter; +import org.springframework.security.ui.logout.LogoutHandler; +import org.springframework.security.ui.logout.SecurityContextLogoutHandler; +import org.springframework.util.StringUtils; +import org.w3c.dom.Element; + +/** + * @author Luke Taylor + * @version $Id$ + */ +public class LogoutBeanDefinitionParser extends AbstractSingleBeanDefinitionParser { + public static final String DEFAULT_LOGOUT_SUCCESS_URL = "/"; + + protected Class getBeanClass(Element element) { + return LogoutFilter.class; + } + + protected void doParse(Element element, BeanDefinitionBuilder builder) { + String logoutUrl = element.getAttribute("logoutUrl"); + + if (StringUtils.hasText(logoutUrl)) { + builder.addPropertyValue("filterProcessesUrl", logoutUrl); + } + + String logoutSuccessUrl = element.getAttribute("logoutSuccessUrl"); + + if (!StringUtils.hasText(logoutSuccessUrl)) { + logoutSuccessUrl = DEFAULT_LOGOUT_SUCCESS_URL; + } + + builder.addConstructorArg(logoutSuccessUrl); + builder.addConstructorArg(new LogoutHandler[] {new SecurityContextLogoutHandler()}); + } + + protected String resolveId(Element element, AbstractBeanDefinition definition, ParserContext parserContext) throws BeanDefinitionStoreException { + String id = super.resolveId(element, definition, parserContext); + + if (StringUtils.hasText(id)) { + return id; + } + + return HttpSecurityBeanDefinitionParser.DEFAULT_LOGOUT_FILTER_ID; + } +} diff --git a/core/src/main/java/org/springframework/security/config/SecurityNamespaceHandler.java b/core/src/main/java/org/springframework/security/config/SecurityNamespaceHandler.java index ec7264ba82..a755fc10f8 100644 --- a/core/src/main/java/org/springframework/security/config/SecurityNamespaceHandler.java +++ b/core/src/main/java/org/springframework/security/config/SecurityNamespaceHandler.java @@ -12,7 +12,9 @@ import org.springframework.beans.factory.xml.NamespaceHandlerSupport; public class SecurityNamespaceHandler extends NamespaceHandlerSupport { public void init() { registerBeanDefinitionParser("ldap", new LdapBeanDefinitionParser()); - - + registerBeanDefinitionParser("http", new HttpSecurityBeanDefinitionParser()); + registerBeanDefinitionParser("authentication-provider", new AuthenticationProviderBeanDefinitionParser()); + registerBeanDefinitionParser("autoconfig", new AutoConfigBeanDefinitionParser()); + registerBeanDefinitionDecorator("intercept-methods", new InterceptMethodsBeanDefinitionDecorator()); } } diff --git a/core/src/main/java/org/springframework/security/config/UserServiceBeanDefinitionParser.java b/core/src/main/java/org/springframework/security/config/UserServiceBeanDefinitionParser.java new file mode 100644 index 0000000000..1a97479e60 --- /dev/null +++ b/core/src/main/java/org/springframework/security/config/UserServiceBeanDefinitionParser.java @@ -0,0 +1,61 @@ +package org.springframework.security.config; + +import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser; +import org.springframework.beans.factory.xml.ParserContext; +import org.springframework.beans.factory.support.BeanDefinitionBuilder; +import org.springframework.beans.factory.support.AbstractBeanDefinition; +import org.springframework.beans.factory.BeanDefinitionStoreException; +import org.springframework.security.userdetails.memory.InMemoryDaoImpl; +import org.springframework.security.userdetails.memory.UserMap; +import org.springframework.security.userdetails.User; +import org.springframework.security.util.AuthorityUtils; +import org.springframework.util.xml.DomUtils; +import org.springframework.util.StringUtils; +import org.w3c.dom.Element; + +import java.util.List; +import java.util.Iterator; + +/** + * @author luke + * @version $Id$ + */ +public class UserServiceBeanDefinitionParser extends AbstractSingleBeanDefinitionParser { + + public static final String DEFAULT_ID = "_userDetailsService"; + + protected Class getBeanClass(Element element) { + return InMemoryDaoImpl.class; + } + + + protected void doParse(Element element, BeanDefinitionBuilder builder) { + List userElts = DomUtils.getChildElementsByTagName(element, "user"); + UserMap users = new UserMap(); + + for (Iterator i = userElts.iterator(); i.hasNext();) { + Element userElt = (Element) i.next(); + String userName = userElt.getAttribute("name"); + String password = userElt.getAttribute("password"); + + users.addUser(new User(userName, password, true, true, true, true, + AuthorityUtils.commaSeparatedStringToAuthorityArray(userElt.getAttribute("authorities")))); + } + + builder.addPropertyValue("userMap", users); + + + } + + protected String resolveId(Element element, AbstractBeanDefinition definition, ParserContext parserContext) throws BeanDefinitionStoreException { + String id = super.resolveId(element, definition, parserContext); + + if (StringUtils.hasText(id)) { + return id; + } + + // TODO: Check for duplicate using default id here. + + return DEFAULT_ID; + } +} diff --git a/core/src/main/java/org/springframework/security/util/AuthorityUtils.java b/core/src/main/java/org/springframework/security/util/AuthorityUtils.java new file mode 100644 index 0000000000..441dac50bb --- /dev/null +++ b/core/src/main/java/org/springframework/security/util/AuthorityUtils.java @@ -0,0 +1,32 @@ +package org.springframework.security.util; + +import org.springframework.security.GrantedAuthority; +import org.springframework.security.GrantedAuthorityImpl; +import org.springframework.util.StringUtils; + +/** + * @author luke + * @version $Id$ + */ +public abstract class AuthorityUtils { + + /** + * Creates a array of GrantedAuthority objects from a comma-separated string + * representation (e.g. "ROLE_A, ROLE_B, ROLE_C"). + * + * @param authorityString the comma-separated string + * @return the authorities created by tokenizing the string + */ + public static GrantedAuthority[] commaSeparatedStringToAuthorityArray(String authorityString) { + String[] authorityStrings = StringUtils.tokenizeToStringArray(authorityString, ","); + GrantedAuthority[] authorities = new GrantedAuthority[authorityStrings.length]; + + for (int i=0; i < authorityStrings.length; i++) { + authorities[i] = new GrantedAuthorityImpl(authorityStrings[i]); + } + + return authorities; + } + + +} 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 0e2ef5b2ff..9cabe595ec 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 @@ -1,22 +1,184 @@ - - - + - - - - - - - - - - - - - - - \ No newline at end of file + + + Provides automatic security configration for a application + + + + + + Sets up an ldap authentication provider, optionally with an embedded ldap server + + + + + + + + + Specifies the ldap server Url. If omitted, an embedded server will be created + + + + + Explicitly specify an ldif file resource to load + + + + + + + + + + + + + Defines a protected method and the access control configuration attributes that apply to it + + + + + + + + + A method name + + + + + Access configuration attributes list that applies to the method, e.g. "ROLE_A,ROLE_B" + + + + + + Container element for HTTP security configuration + + + + + + + + + + + + + + Controls the eagerness with which an HTTP session is created. + + + + + + + + + + + + Defines the type of path used to define URLs in child elements. + + + + + + + + + + + Whether test URLs should be converted to lower case prior to comparing with defined path patterns. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Sets up a form login configuration + + + + + + + + + The URL that the form is submitted to + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/src/test/java/org/springframework/security/config/HttpSecurityBeanDefinitionParserTests.java b/core/src/test/java/org/springframework/security/config/HttpSecurityBeanDefinitionParserTests.java new file mode 100644 index 0000000000..87a15adc92 --- /dev/null +++ b/core/src/test/java/org/springframework/security/config/HttpSecurityBeanDefinitionParserTests.java @@ -0,0 +1,23 @@ +package org.springframework.security.config; + +import org.springframework.context.support.ClassPathXmlApplicationContext; +import org.junit.BeforeClass; +import org.junit.Test; + +/** + * @author Luke Taylor + * @version $Id$ + */ +public class HttpSecurityBeanDefinitionParserTests { + private static ClassPathXmlApplicationContext appContext; + + @BeforeClass + public static void loadContext() { + appContext = new ClassPathXmlApplicationContext("org/springframework/security/config/http-security.xml"); + } + + @Test + public void testContextContainsExpectedBeansAndData() { + } + +} diff --git a/core/src/test/java/org/springframework/security/config/InterceptMethodsBeanDefinitionDecoratorTests.java b/core/src/test/java/org/springframework/security/config/InterceptMethodsBeanDefinitionDecoratorTests.java new file mode 100644 index 0000000000..92aad11bbd --- /dev/null +++ b/core/src/test/java/org/springframework/security/config/InterceptMethodsBeanDefinitionDecoratorTests.java @@ -0,0 +1,22 @@ +package org.springframework.security.config; + +import org.springframework.context.support.ClassPathXmlApplicationContext; +import org.junit.BeforeClass; +import org.junit.Test; + +/** + * @author luke + * @version $Id$ + */ +public class InterceptMethodsBeanDefinitionDecoratorTests { + private static ClassPathXmlApplicationContext appContext; + + @BeforeClass + public static void loadContext() { + appContext = new ClassPathXmlApplicationContext("org/springframework/security/config/method-security.xml"); + } + + @Test + public void contextShouldContainCorrectBeans() { + } +} diff --git a/core/src/test/java/org/springframework/security/config/TestBusinessBean.java b/core/src/test/java/org/springframework/security/config/TestBusinessBean.java new file mode 100644 index 0000000000..c3325dc9c3 --- /dev/null +++ b/core/src/test/java/org/springframework/security/config/TestBusinessBean.java @@ -0,0 +1,16 @@ +package org.springframework.security.config; + +/** + * @author luke + * @version $Id$ + */ +public interface TestBusinessBean { + + void setInteger(int i); + + int getInteger(); + + void setString(String s); + + void doSomething(); +} diff --git a/core/src/test/java/org/springframework/security/config/TestBusinessBeanImpl.java b/core/src/test/java/org/springframework/security/config/TestBusinessBeanImpl.java new file mode 100644 index 0000000000..1e133151e8 --- /dev/null +++ b/core/src/test/java/org/springframework/security/config/TestBusinessBeanImpl.java @@ -0,0 +1,24 @@ +package org.springframework.security.config; + +/** + * @author luke + * @version $Id$ + */ +public class TestBusinessBeanImpl implements TestBusinessBean { + public void setInteger(int i) { + } + + public int getInteger() { + return 1314; + } + + public void setString(String s) { + } + + public String getString() { + return "A string."; + } + + public void doSomething() { + } +} diff --git a/core/src/test/resources/org/springframework/security/config/http-security.xml b/core/src/test/resources/org/springframework/security/config/http-security.xml new file mode 100644 index 0000000000..3c314c0143 --- /dev/null +++ b/core/src/test/resources/org/springframework/security/config/http-security.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/core/src/test/resources/org/springframework/security/config/ldap-embedded-default.xml b/core/src/test/resources/org/springframework/security/config/ldap-embedded-default.xml index 48aead85d3..64ade8e596 100644 --- a/core/src/test/resources/org/springframework/security/config/ldap-embedded-default.xml +++ b/core/src/test/resources/org/springframework/security/config/ldap-embedded-default.xml @@ -10,5 +10,4 @@ http://www.springframework.org/schema/security http://www.springframework.org/sc - \ No newline at end of file diff --git a/core/src/test/resources/org/springframework/security/config/method-security.xml b/core/src/test/resources/org/springframework/security/config/method-security.xml new file mode 100644 index 0000000000..0a9d68cf69 --- /dev/null +++ b/core/src/test/resources/org/springframework/security/config/method-security.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file