/** Constructor. */ protected AbstractXMLObjectMarshaller() { marshallerFactory = Configuration.getMarshallerFactory(); }
/** * Constructor. */ protected AbstractXMLObjectUnmarshaller() { xmlObjectBuilderFactory = Configuration.getBuilderFactory(); unmarshallerFactory = Configuration.getUnmarshallerFactory(); }
Configuration.getGlobalSecurityConfiguration().getDefaultKeyInfoCredentialResolver(), new org.springframework.security.saml.trust.CertPathPKIXTrustEvaluator(pkixOptions), new BasicX509CredentialNameEvaluator()); return new AllowAllSignatureTrustEngine(Configuration.getGlobalSecurityConfiguration().getDefaultKeyInfoCredentialResolver());
/** * Initialise the SAML library */ public static synchronized void initSamlEngine() { if (!samlEngineInitialized) { if (LOG.isDebugEnabled()) { LOG.debug("Initializing the opensaml2 library..."); } try { OpenSAMLBootstrap.bootstrap(); builderFactory = Configuration.getBuilderFactory(); marshallerFactory = Configuration.getMarshallerFactory(); unmarshallerFactory = Configuration.getUnmarshallerFactory(); samlEngineInitialized = true; if (LOG.isDebugEnabled()) { LOG.debug("opensaml2 library bootstrap complete"); } } catch (ConfigurationException e) { LOG.error( "Unable to bootstrap the opensaml2 library - all SAML operations will fail", e ); } } }
/** * Constructor. * * @param newOptions the options to be used by the generator */ protected BasicKeyInfoGenerator(BasicOptions newOptions) { options = newOptions; keyInfoBuilder = (KeyInfoBuilder) Configuration.getBuilderFactory().getBuilder(KeyInfo.DEFAULT_ELEMENT_NAME); }
/** Constructor. */ public BaseMetadataProvider() { requireValidMetadata = false; unmarshallerFactory = Configuration.getUnmarshallerFactory(); }
/** * Ensure that the XMLObject is marshalled. * * @param xmlObject the object to check and marshall * @throws DecryptionException thrown if there is an error when marshalling the XMLObject */ protected void checkAndMarshall(XMLObject xmlObject) throws DecryptionException { Element targetElement = xmlObject.getDOM(); if (targetElement == null) { Marshaller marshaller = Configuration.getMarshallerFactory().getMarshaller(xmlObject); if (marshaller == null) { marshaller = Configuration.getMarshallerFactory().getMarshaller(Configuration.getDefaultProviderQName()); if (marshaller == null) { String errorMsg = "No marshaller available for " + xmlObject.getElementQName(); log.error(errorMsg); throw new DecryptionException(errorMsg); } } try { targetElement = marshaller.marshall(xmlObject); } catch (MarshallingException e) { log.error("Error marshalling target XMLObject", e); throw new DecryptionException("Error marshalling target XMLObject", e); } } }
/** * Unmarshall a DOM Attr to an AttributeMap. * * @param attributeMap the target AttributeMap * @param attribute the target DOM Attr */ public static void unmarshallToAttributeMap(AttributeMap attributeMap, Attr attribute) { QName attribQName = XMLHelper.constructQName(attribute.getNamespaceURI(), attribute.getLocalName(), attribute .getPrefix()); attributeMap.put(attribQName, attribute.getValue()); if (attribute.isId() || Configuration.isIDAttribute(attribQName)) { attributeMap.registerID(attribQName); } }
/** * Initialise the SAML library */ public static synchronized void initSamlEngine() { if (!samlEngineInitialized) { if (LOG.isDebugEnabled()) { LOG.debug("Initializing the opensaml2 library..."); } try { OpenSAMLBootstrap.bootstrap(); builderFactory = Configuration.getBuilderFactory(); marshallerFactory = Configuration.getMarshallerFactory(); unmarshallerFactory = Configuration.getUnmarshallerFactory(); samlEngineInitialized = true; if (LOG.isDebugEnabled()) { LOG.debug("opensaml2 library bootstrap complete"); } } catch (ConfigurationException e) { LOG.error( "Unable to bootstrap the opensaml2 library - all SAML operations will fail", e ); } } }
/** * Constructor. * * @param newOptions the options to be used by the generator */ protected BasicKeyInfoGenerator(BasicOptions newOptions) { options = newOptions; keyInfoBuilder = (KeyInfoBuilder) Configuration.getBuilderFactory().getBuilder(KeyInfo.DEFAULT_ELEMENT_NAME); }
/** * Constructor. * * @param newResolver resolver for data encryption keys. * @param newKEKResolver resolver for key encryption keys. * @param newEncKeyResolver resolver for EncryptedKey elements */ public Decrypter(KeyInfoCredentialResolver newResolver, KeyInfoCredentialResolver newKEKResolver, EncryptedKeyResolver newEncKeyResolver) { resolver = newResolver; kekResolver = newKEKResolver; encKeyResolver = newEncKeyResolver; resolverCriteria = null; kekResolverCriteria = null; // Note: Use of this internal JAXP ParserPool is hopefully only temporary, // to be replaced when Xerces implements DOM 3 LSParser.parseWithContext(...). parserPool = buildParserPool(); unmarshallerFactory = Configuration.getUnmarshallerFactory(); defaultRootInNewDocument = false; }
/** * Unmarshall a DOM Attr to an AttributeMap. * * @param attributeMap the target AttributeMap * @param attribute the target DOM Attr */ public static void unmarshallToAttributeMap(AttributeMap attributeMap, Attr attribute) { QName attribQName = XMLHelper.constructQName(attribute.getNamespaceURI(), attribute.getLocalName(), attribute .getPrefix()); attributeMap.put(attribQName, attribute.getValue()); if (attribute.isId() || Configuration.isIDAttribute(attribQName)) { attributeMap.registerID(attribQName); } }
/** Constructor. */ protected AbstractXMLObjectMarshaller() { marshallerFactory = Configuration.getMarshallerFactory(); }
/** * Initialise the SAML library */ public synchronized static void initSamlEngine() { if (!samlEngineInitialized) { if (log.isDebugEnabled()) { log.debug("Initilizing the opensaml2 library..."); } try { DefaultBootstrap.bootstrap(); builderFactory = Configuration.getBuilderFactory(); marshallerFactory = Configuration.getMarshallerFactory(); unmarshallerFactory = Configuration.getUnmarshallerFactory(); samlEngineInitialized = true; if (log.isDebugEnabled()) { log.debug("opensaml2 library bootstrap complete"); } } catch (ConfigurationException e) { log.error( "Unable to bootstrap the opensaml2 library - all SAML operations will fail", e ); } } }
/** * Constructor. * * @param newOptions the options to be used by the generator */ protected X509KeyInfoGenerator(X509Options newOptions) { super(newOptions); options = newOptions; keyInfoBuilder = (KeyInfoBuilder) Configuration.getBuilderFactory().getBuilder(KeyInfo.DEFAULT_ELEMENT_NAME); x509DataBuilder = (X509DataBuilder) Configuration.getBuilderFactory().getBuilder(X509Data.DEFAULT_ELEMENT_NAME); }
/** * Constructor. */ protected AbstractXMLObjectUnmarshaller() { xmlObjectBuilderFactory = Configuration.getBuilderFactory(); unmarshallerFactory = Configuration.getUnmarshallerFactory(); }
/** * Constructor. * * @param newResolver resolver for data encryption keys. * @param newKEKResolver resolver for key encryption keys. * @param newEncKeyResolver resolver for EncryptedKey elements */ public Decrypter(KeyInfoCredentialResolver newResolver, KeyInfoCredentialResolver newKEKResolver, EncryptedKeyResolver newEncKeyResolver) { resolver = newResolver; kekResolver = newKEKResolver; encKeyResolver = newEncKeyResolver; resolverCriteria = null; kekResolverCriteria = null; // Note: Use of this internal JAXP ParserPool is hopefully only temporary, // to be replaced when Xerces implements DOM 3 LSParser.parseWithContext(...). parserPool = buildParserPool(); unmarshallerFactory = Configuration.getUnmarshallerFactory(); defaultRootInNewDocument = false; }
@Override public void afterPropertiesSet() throws Exception { BasicSecurityConfiguration config = (BasicSecurityConfiguration) Configuration.getGlobalSecurityConfiguration(); switch (signatureAlgorithm) { case SHA1: config.registerSignatureAlgorithmURI("RSA", SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA1); config.setSignatureReferenceDigestMethod(SignatureConstants.ALGO_ID_DIGEST_SHA1); break; case SHA256: config.registerSignatureAlgorithmURI("RSA", SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA256); config.setSignatureReferenceDigestMethod(SignatureConstants.ALGO_ID_DIGEST_SHA256); break; case SHA512: config.registerSignatureAlgorithmURI("RSA", SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA512); config.setSignatureReferenceDigestMethod(SignatureConstants.ALGO_ID_DIGEST_SHA512); break; } }
/** {@inheritDoc} */ protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException { AuthnContextDecl authnCtxDecl = (AuthnContextDecl) xmlObject; Attr attribute; for (Entry<QName, String> entry : authnCtxDecl.getUnknownAttributes().entrySet()) { attribute = XMLHelper.constructAttribute(domElement.getOwnerDocument(), entry.getKey()); attribute.setValue(entry.getValue()); domElement.setAttributeNodeNS(attribute); if (Configuration.isIDAttribute(entry.getKey()) || authnCtxDecl.getUnknownAttributes().isIDAttribute(entry.getKey())) { attribute.getOwnerElement().setIdAttributeNode(attribute, true); } } }
/** * This constructor supports checking an XMLObject to be marshalled, either element name or schema type, against a * given namespace/local name pair. * * @deprecated no replacement * * @param targetNamespaceURI the namespace URI of either the schema type QName or element QName of the elements this * unmarshaller operates on * @param targetLocalName the local name of either the schema type QName or element QName of the elements this * unmarshaller operates on */ protected AbstractXMLObjectMarshaller(String targetNamespaceURI, String targetLocalName) { targetQName = XMLHelper.constructQName(targetNamespaceURI, targetLocalName, null); marshallerFactory = Configuration.getMarshallerFactory(); }