net.shibboleth.utilities.java.support.xml.XMLParserException Java Examples

The following examples show how to use net.shibboleth.utilities.java.support.xml.XMLParserException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SamlClient.java    From saml-client with MIT License 5 votes vote down vote up
private static DOMMetadataResolver createMetadataResolver(InputStream metadata)
    throws SamlException {
  try {
    BasicParserPool parser = createDOMParser();
    Document metadataDocument = parser.parse(metadata);
    DOMMetadataResolver resolver = new DOMMetadataResolver(metadataDocument.getDocumentElement());
    resolver.setId(
        "componentId"); // The resolver needs an ID for the initialization to go through.
    resolver.initialize();
    return resolver;
  } catch (ComponentInitializationException | XMLParserException ex) {
    throw new SamlException("Cannot load identity provider metadata", ex);
  }
}
 
Example #2
Source File: SamlClient.java    From saml-client with MIT License 5 votes vote down vote up
private SAMLObject parseResponse(String encodedResponse, String method) throws SamlException {
  logger.trace("Validating SAML response " + encodedResponse);
  try {
    Document responseDocument = domParser.parse(decodeAndInflate(encodedResponse, method));
    return (SAMLObject)
        XMLObjectProviderRegistrySupport.getUnmarshallerFactory()
            .getUnmarshaller(responseDocument.getDocumentElement())
            .unmarshall(responseDocument.getDocumentElement());
  } catch (UnmarshallingException | XMLParserException ex) {
    throw new SamlException("Cannot decode xml encoded response", ex);
  }
}
 
Example #3
Source File: SAML2IdPCache.java    From syncope with Apache License 2.0 5 votes vote down vote up
@Transactional(readOnly = true)
public SAML2IdPEntity put(final SAML2IdP idp)
        throws CertificateException, IOException, KeyStoreException, NoSuchAlgorithmException, WSSecurityException,
        XMLParserException {

    Element element = OpenSAMLUtil.getParserPool().parse(
            new InputStreamReader(new ByteArrayInputStream(idp.getMetadata()))).getDocumentElement();
    EntityDescriptor entityDescriptor = (EntityDescriptor) OpenSAMLUtil.fromDom(element);
    return put(entityDescriptor, binder.getIdPTO(idp));
}