2 * Copyright [2007] [University Corporation for Advanced Internet Development, Inc.]
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package edu.internet2.middleware.shibboleth.idp.config.profile;
19 import java.util.List;
22 import javax.xml.namespace.QName;
24 import org.opensaml.xml.util.XMLHelper;
25 import org.springframework.beans.factory.support.AbstractBeanDefinition;
26 import org.springframework.beans.factory.support.BeanDefinitionBuilder;
27 import org.springframework.beans.factory.xml.AbstractBeanDefinitionParser;
28 import org.springframework.beans.factory.xml.ParserContext;
29 import org.w3c.dom.Element;
31 import edu.internet2.middleware.shibboleth.common.config.SpringConfigurationUtils;
34 * Spring bean definition parser for profile handler root element.
36 public class ProfileHandlerGroupBeanDefinitionParser extends AbstractBeanDefinitionParser {
38 /** Schema type name. */
39 public static final QName SCHEMA_TYPE = new QName(ProfileHandlerNamespaceHandler.NAMESPACE, "ProfileHandlerGroup");
42 protected AbstractBeanDefinition parseInternal(Element config, ParserContext context) {
43 BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(ProfileHandlerGroup.class);
45 Map<QName, List<Element>> configChildren = XMLHelper.getChildElements(config);
46 List<Element> children;
48 children = configChildren.get(new QName(ProfileHandlerNamespaceHandler.NAMESPACE, "ErrorHandler"));
49 builder.addPropertyValue("errorHandler", SpringConfigurationUtils.parseCustomElement(children.get(0), context));
51 children = configChildren.get(new QName(ProfileHandlerNamespaceHandler.NAMESPACE, "ProfileHandler"));
52 builder.addPropertyValue("profileHandlers", SpringConfigurationUtils.parseCustomElements(children, context));
54 children = configChildren.get(new QName(ProfileHandlerNamespaceHandler.NAMESPACE, "AuthenticationHandler"));
55 builder.addPropertyValue("authenticationHandlers", SpringConfigurationUtils.parseCustomElements(children,
58 return builder.getBeanDefinition();
62 protected boolean shouldGenerateId() {