List of usage examples for org.springframework.security.config.http FormLoginBeanDefinitionParser getFilterBean
RootBeanDefinition getFilterBean()
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 . ja va2 s .com*/ 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
void createOpenIDLoginFilter(BeanReference sessionStrategy, BeanReference authManager) { Element openIDLoginElt = DomUtils.getChildElementByTagName(httpElt, Elements.OPENID_LOGIN); RootBeanDefinition openIDFilter = null; if (openIDLoginElt != null) { FormLoginBeanDefinitionParser parser = new FormLoginBeanDefinitionParser("/login/openid", null, OPEN_ID_AUTHENTICATION_PROCESSING_FILTER_CLASS, requestCache, sessionStrategy, allowSessionCreation, portMapper, portResolver); parser.parse(openIDLoginElt, pc); openIDFilter = parser.getFilterBean(); openIDEntryPoint = parser.getEntryPointBean(); openidLoginProcessingUrl = parser.getLoginProcessingUrl(); openIDLoginPage = parser.getLoginPage(); List<Element> attrExElts = DomUtils.getChildElementsByTagName(openIDLoginElt, Elements.OPENID_ATTRIBUTE_EXCHANGE); if (!attrExElts.isEmpty()) { // Set up the consumer with the required attribute list BeanDefinitionBuilder consumerBldr = BeanDefinitionBuilder .rootBeanDefinition(OPEN_ID_CONSUMER_CLASS); BeanDefinitionBuilder axFactory = BeanDefinitionBuilder .rootBeanDefinition(OPEN_ID_ATTRIBUTE_FACTORY_CLASS); ManagedMap<String, ManagedList<BeanDefinition>> axMap = new ManagedMap<String, ManagedList<BeanDefinition>>(); for (Element attrExElt : attrExElts) { String identifierMatch = attrExElt.getAttribute("identifier-match"); if (!StringUtils.hasText(identifierMatch)) { if (attrExElts.size() > 1) { pc.getReaderContext() .error("You must supply an identifier-match attribute if using more" + " than one " + Elements.OPENID_ATTRIBUTE_EXCHANGE + " element", attrExElt); }/*from ww w. jav a 2 s . c om*/ // Match anything identifierMatch = ".*"; } axMap.put(identifierMatch, parseOpenIDAttributes(attrExElt)); } axFactory.addConstructorArgValue(axMap); consumerBldr.addConstructorArgValue(axFactory.getBeanDefinition()); openIDFilter.getPropertyValues().addPropertyValue("consumer", consumerBldr.getBeanDefinition()); } } if (openIDFilter != null) { openIDFilter.getPropertyValues().addPropertyValue("allowSessionCreation", allowSessionCreation); openIDFilter.getPropertyValues().addPropertyValue("authenticationManager", authManager); // Required by login page filter openIDFilterId = pc.getReaderContext().generateBeanName(openIDFilter); pc.registerBeanComponent(new BeanComponentDefinition(openIDFilter, openIDFilterId)); injectRememberMeServicesRef(openIDFilter, rememberMeServicesId); createOpenIDProvider(); } }