List of usage examples for org.w3c.dom Element getAttributeNS
public String getAttributeNS(String namespaceURI, String localName) throws DOMException;
From source file:edu.osu.ocio.shibboleth.idp.authn.provider.StatelessLoginHandlerBeanDefinitionParser.java
/** {@inheritDoc} */ protected void doParse(Element config, BeanDefinitionBuilder builder) { super.doParse(config, builder); if (config.hasAttributeNS(null, "authenticationServletURL")) { builder.addPropertyValue("authenticationServletURL", DatatypeHelper.safeTrim(config.getAttributeNS(null, "authenticationServletURL"))); } else {// ww w .ja v a2 s . c om builder.addPropertyValue("authenticationServletURL", "/Authn/Stateless"); } }
From source file:org.crisp.aai.idp.bridge.BridgeLoginHandlerBeanDefinitionParser.java
protected void doParse(Element config, BeanDefinitionBuilder builder) { super.doParse(config, builder); if (config.hasAttributeNS(null, "protectedServletPath")) { builder.addPropertyValue("protectedServletPath", DatatypeHelper.safeTrimOrNullString(config.getAttributeNS(null, "protectedServletPath"))); } else {//from w w w. j a v a 2s . c o m builder.addPropertyValue("protectedServletPath", "/Authn/Bridge"); } }
From source file:edu.internet2.middleware.shibboleth.common.config.security.ChainingSignatureTrustEngineBeanDefinitionParser.java
/** {@inheritDoc} */ @SuppressWarnings("unchecked") protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { log.info("Parsing configuration for {} trust engine with id: {}", XMLHelper.getXSIType(element).getLocalPart(), element.getAttributeNS(null, "id")); ManagedList managedChain = new ManagedList(); Element child = XMLHelper.getFirstChildElement(element); while (child != null) { QName childName = XMLHelper.getNodeQName(child); if (TRUST_ENGINE_NAME.equals(childName)) { log.debug("Parsing chain trust engine member {}", element.getAttributeNS(null, "id")); managedChain.add(SpringConfigurationUtils.parseCustomElement(child, parserContext)); } else if (TRUST_ENGINE_REF_NAME.equals(childName)) { log.debug("Parsing chain trust engine member reference {}", element.getAttributeNS(null, "ref")); managedChain.add(SpringConfigurationUtils.parseCustomElementReference(child, "ref", parserContext)); } else {//from w ww. j ava 2 s . c o m log.error("Unsupported child element of chaining trust engine '{}' encountered with name: {}", element.getAttributeNS(null, "id"), childName); throw new FatalBeanException("Unsupported child element of chaining trust engine encountered"); } child = XMLHelper.getNextSiblingElement(child); } builder.addPropertyValue("chain", managedChain); }
From source file:com.ryantenney.metrics.spring.config.RegisterMetricBeanDefinitionParser.java
@Override public BeanDefinition parse(Element element, ParserContext parserContext) { final CompositeComponentDefinition compDefinition = new CompositeComponentDefinition(element.getTagName(), parserContext.extractSource(element)); parserContext.pushContainingComponent(compDefinition); final String metricRegistryBeanName = element.getAttribute("metric-registry"); if (!StringUtils.hasText(metricRegistryBeanName)) { throw new RuntimeException(); // TODO }//from www.jav a2s. c o m final RuntimeBeanReference metricRegistryBeanRef = new RuntimeBeanReference(metricRegistryBeanName); final List<Element> metricElements = DomUtils.getChildElementsByTagName(element, new String[] { "bean", "ref" }); for (Element metricElement : metricElements) { // Get the name attribute and remove it (to prevent Spring from looking for a BeanDefinitionDecorator) final String name = metricElement.getAttributeNS(METRICS_NAMESPACE, "name"); if (name != null) { metricElement.removeAttributeNS(METRICS_NAMESPACE, "name"); } final Object metric = parserContext.getDelegate().parsePropertySubElement(metricElement, null); final RootBeanDefinition metricRegistererDef = new RootBeanDefinition(MetricRegisterer.class); metricRegistererDef.setSource(parserContext.extractSource(metricElement)); metricRegistererDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); final ConstructorArgumentValues args = metricRegistererDef.getConstructorArgumentValues(); args.addIndexedArgumentValue(0, metricRegistryBeanRef); args.addIndexedArgumentValue(1, name); args.addIndexedArgumentValue(2, metric); final String beanName = parserContext.getReaderContext().registerWithGeneratedName(metricRegistererDef); parserContext.registerComponent(new BeanComponentDefinition(metricRegistererDef, beanName)); } parserContext.popAndRegisterContainingComponent(); return null; }
From source file:edu.internet2.middleware.shibboleth.idp.config.profile.authn.RemoteUserLoginHandlerBeanDefinitionParser.java
/** {@inheritDoc} */ protected void doParse(Element config, BeanDefinitionBuilder builder) { super.doParse(config, builder); if (config.hasAttributeNS(null, "protectedServletPath")) { builder.addPropertyValue("protectedServletPath", DatatypeHelper.safeTrimOrNullString(config.getAttributeNS(null, "protectedServletPath"))); } else {/*from w w w.j a v a2s. co m*/ builder.addPropertyValue("protectedServletPath", "/Authn/RemoteUser"); } }
From source file:edu.internet2.middleware.shibboleth.common.config.attribute.resolver.attributeDefinition.ScopedAttributeDefinitionBeanDefinitionParser.java
/** {@inheritDoc} */ protected void doParse(String pluginId, Element pluginConfig, Map<QName, List<Element>> pluginConfigChildren, BeanDefinitionBuilder pluginBuilder, ParserContext parserContext) { super.doParse(pluginId, pluginConfig, pluginConfigChildren, pluginBuilder, parserContext); String scope = pluginConfig.getAttributeNS(null, "scope"); log.debug("Setting scope of attribute definition {} to: {}", pluginId, scope); pluginBuilder.addPropertyValue("scope", scope); }
From source file:de.betterform.connector.SchemaValidator.java
/** * method to get the target namespace of a schema given by an URI: * it opens the schema at the given URI, anf looks for the "targetNamespace" attribute * * @param uri the URI of the schema/*w w w .j a v a2s .com*/ * @return the targetNamespace of the schema, or null of none was found */ private String getSchemaNamespace(URI uri) throws Exception { String ns = null; //load schema File schemaFile = new File(uri); Document doc = DOMUtil.parseXmlFile(schemaFile, true, false); if (doc != null) { Element schema = doc.getDocumentElement(); ns = schema.getAttributeNS(NamespaceConstants.XMLSCHEMA_NS, "targetNamespace"); if (ns == null || ns.equals("")) //try without NS ! ns = schema.getAttribute("targetNamespace"); } else LOGGER.warn("Schema " + uri.toString() + " could not be parsed"); if (LOGGER.isDebugEnabled()) LOGGER.debug("SchemaValidator.getSchemaNamespace for schema " + uri.toString() + ": " + ns); return ns; }
From source file:edu.internet2.middleware.shibboleth.common.config.security.AbstractBasicCredentialBeanDefinitionParser.java
/** {@inheritDoc} */ protected void doParse(Element element, BeanDefinitionBuilder builder) { log.info("Parsing configuration for {} credential with id: {}", XMLHelper.getXSIType(element).getLocalPart(), element.getAttributeNS(null, "id")); parseAttributes(element, builder);/* ww w . ja v a 2 s .c o m*/ Map<QName, List<Element>> configChildren = XMLHelper.getChildElements(element); parseCommon(configChildren, builder); parseSecretKey(configChildren, builder); parsePrivateKey(configChildren, builder); parsePublicKey(configChildren, builder); }
From source file:edu.internet2.middleware.shibboleth.common.config.attribute.filtering.AttributeFilterPolicyBeanDefinitionParser.java
/** {@inheritDoc} */ protected void doParse(Element config, ParserContext parserContext, BeanDefinitionBuilder builder) { super.doParse(config, parserContext, builder); String policyId = DatatypeHelper.safeTrimOrNullString(config.getAttributeNS(null, "id")); log.info("Parsing configuration for attribute filter policy {}", policyId); builder.addPropertyValue("policyId", policyId); List<Element> children; Map<QName, List<Element>> childrenMap = XMLHelper.getChildElements(config); children = childrenMap.get(new QName(AttributeFilterNamespaceHandler.NAMESPACE, "PolicyRequirementRule")); if (children != null && children.size() > 0) { builder.addPropertyValue("policyRequirement", SpringConfigurationUtils.parseInnerCustomElement(children.get(0), parserContext)); } else {/*ww w . j a v a2 s . c o m*/ children = childrenMap .get(new QName(AttributeFilterNamespaceHandler.NAMESPACE, "PolicyRequirementRuleReference")); String reference = getAbsoluteReference(config, "PolicyRequirementRule", children.get(0).getTextContent()); builder.addPropertyReference("policyRequirement", reference); } ManagedList attributeRules = new ManagedList(); children = childrenMap.get(new QName(AttributeFilterNamespaceHandler.NAMESPACE, "AttributeRule")); if (children != null && children.size() > 0) { attributeRules.addAll(SpringConfigurationUtils.parseInnerCustomElements(children, parserContext)); } children = childrenMap.get(new QName(AttributeFilterNamespaceHandler.NAMESPACE, "AttributeRuleReference")); if (children != null && children.size() > 0) { String reference; for (Element child : children) { reference = getAbsoluteReference(config, "AttributeRule", child.getTextContent()); attributeRules.add(new RuntimeBeanReference(reference)); } } builder.addPropertyValue("attributeRules", attributeRules); }
From source file:edu.internet2.middleware.shibboleth.idp.config.profile.authn.UsernamePasswordLoginHandlerBeanDefinitionParser.java
/** {@inheritDoc} */ protected void doParse(Element config, BeanDefinitionBuilder builder) { super.doParse(config, builder); if (config.hasAttributeNS(null, "authenticationServletURL")) { builder.addPropertyValue("authenticationServletURL", DatatypeHelper.safeTrim(config.getAttributeNS(null, "authenticationServletURL"))); } else {/*from www.j a v a 2 s . c o m*/ builder.addPropertyValue("authenticationServletURL", "/Authn/UserPassword"); } String jaasConfigurationURL = DatatypeHelper .safeTrim(config.getAttributeNS(null, "jaasConfigurationLocation")); log.debug("Setting JAAS configuration file to: {}", jaasConfigurationURL); System.setProperty("java.security.auth.login.config", jaasConfigurationURL); }