List of usage examples for org.springframework.security.config Elements FORM_LOGIN
String FORM_LOGIN
To view the source code for org.springframework.security.config Elements FORM_LOGIN.
Click Source Link
From source file:org.springframework.security.config.http.AuthenticationConfigBuilder.java
void createFormLoginFilter(BeanReference sessionStrategy, BeanReference authManager) { Element formLoginElt = DomUtils.getChildElementByTagName(httpElt, Elements.FORM_LOGIN); RootBeanDefinition formFilter = null; if (formLoginElt != null || autoConfig) { FormLoginBeanDefinitionParser parser = new FormLoginBeanDefinitionParser("/login", "POST", AUTHENTICATION_PROCESSING_FILTER_CLASS, requestCache, sessionStrategy, allowSessionCreation, portMapper, portResolver); parser.parse(formLoginElt, pc);/* w w w. jav a2 s . c om*/ formFilter = parser.getFilterBean(); formEntryPoint = parser.getEntryPointBean(); loginProcessingUrl = parser.getLoginProcessingUrl(); formLoginPage = parser.getLoginPage(); } if (formFilter != null) { formFilter.getPropertyValues().addPropertyValue("allowSessionCreation", allowSessionCreation); formFilter.getPropertyValues().addPropertyValue("authenticationManager", authManager); // Id is required by login page filter formFilterId = pc.getReaderContext().generateBeanName(formFilter); pc.registerBeanComponent(new BeanComponentDefinition(formFilter, formFilterId)); injectRememberMeServicesRef(formFilter, rememberMeServicesId); } }
From source file:org.springframework.security.config.http.AuthenticationConfigBuilder.java
private BeanMetadataElement selectEntryPoint() { // We need to establish the main entry point. // First check if a custom entry point bean is set String customEntryPoint = httpElt.getAttribute(ATT_ENTRY_POINT_REF); if (StringUtils.hasText(customEntryPoint)) { return new RuntimeBeanReference(customEntryPoint); }/*from w w w.ja va2 s .c om*/ Element basicAuthElt = DomUtils.getChildElementByTagName(httpElt, Elements.BASIC_AUTH); Element formLoginElt = DomUtils.getChildElementByTagName(httpElt, Elements.FORM_LOGIN); Element openIDLoginElt = DomUtils.getChildElementByTagName(httpElt, Elements.OPENID_LOGIN); // Basic takes precedence if explicit element is used and no others are configured if (basicAuthElt != null && formLoginElt == null && openIDLoginElt == null) { return basicEntryPoint; } // If formLogin has been enabled either through an element or auto-config, then it // is used if no openID login page // has been set. if (formLoginPage != null && openIDLoginPage != null) { pc.getReaderContext().error( "Only one login-page can be defined, either for OpenID or form-login, " + "but not both.", pc.extractSource(openIDLoginElt)); } if (formFilterId != null && openIDLoginPage == null) { return formEntryPoint; } // Otherwise use OpenID if enabled if (openIDFilterId != null) { return openIDEntryPoint; } // If X.509 or JEE have been enabled, use the preauth entry point. if (preAuthEntryPoint != null) { return preAuthEntryPoint; } pc.getReaderContext().error("No AuthenticationEntryPoint could be established. Please " + "make sure you have a login mechanism configured through the namespace (such as form-login) or " + "specify a custom AuthenticationEntryPoint with the '" + ATT_ENTRY_POINT_REF + "' attribute ", pc.extractSource(httpElt)); return null; }