Package org.opensaml.xml.parse

Examples of org.opensaml.xml.parse.StaticBasicParserPool


            configurator.load(ins);
        }
    }
   
    protected static void initializeParserPool() throws ConfigurationException {
        StaticBasicParserPool pp = new StaticBasicParserPool();
        pp.setMaxPoolSize(50);
       
        Map<String, Boolean> features = new HashMap<String, Boolean>();
        features.put(XMLConstants.FEATURE_SECURE_PROCESSING, true);
        features.put("http://apache.org/xml/features/disallow-doctype-decl", true);
        pp.setBuilderFeatures(features);
        pp.setExpandEntityReferences(false);
       
        try {
            pp.initialize();
        } catch (XMLParserException e) {
            throw new ConfigurationException("Error initializing parser pool", e);
        }
        Configuration.setParserPool(pp);
    }
View Full Code Here


            configurator.load(ins);
        }
    }
   
    protected static void initializeParserPool() throws ConfigurationException {
        StaticBasicParserPool pp = new StaticBasicParserPool();
        pp.setMaxPoolSize(50);
       
        Map<String, Boolean> features = new HashMap<String, Boolean>();
        features.put(XMLConstants.FEATURE_SECURE_PROCESSING, true);
        features.put("http://apache.org/xml/features/disallow-doctype-decl", true);
        pp.setBuilderFeatures(features);
        pp.setExpandEntityReferences(false);
       
        try {
            pp.initialize();
        } catch (XMLParserException e) {
            throw new ConfigurationException("Error initializing parser pool", e);
        }
        Configuration.setParserPool(pp);
    }
View Full Code Here

     * </p>
     *
     * @throws ConfigurationException thrown if there is a problem initializing the parser pool
     */
    protected static void initializeParserPool() throws ConfigurationException {
        StaticBasicParserPool pp = new StaticBasicParserPool();
        pp.setMaxPoolSize(50);
        try {
            pp.initialize();
        } catch (XMLParserException e) {
            throw new ConfigurationException("Error initializing parser pool", e);
        }
        Configuration.setParserPool(pp);
    }
View Full Code Here

     * </p>
     *
     * @return a new parser pool instance
     */
    protected ParserPool buildParserPool() {
        StaticBasicParserPool pp = new StaticBasicParserPool();
        HashMap<String, Boolean> features = new HashMap<String, Boolean>();
       
        pp.setNamespaceAware(true);
       
        // Note: this feature config is necessary due to an unresolved Xerces deferred DOM issue/bug
        features.put("http://apache.org/xml/features/dom/defer-node-expansion", Boolean.FALSE);
       
        // The following config is to harden the parser pool against known XML security vulnerabilities
        pp.setExpandEntityReferences(false);
        features.put(XMLConstants.FEATURE_SECURE_PROCESSING, true);
        features.put("http://apache.org/xml/features/disallow-doctype-decl", true);
       
        pp.setBuilderFeatures(features);
       
        try {
            pp.initialize();
            return pp;
        } catch (XMLParserException e) {
            throw new XMLRuntimeException("Problem initializing Decrypter internal ParserPool", e);
        }
    }
View Full Code Here

     * </p>
     *
     * @throws ConfigurationException thrown if there is a problem initializing the parser pool
     */
    protected static void initializeParserPool() throws ConfigurationException {
        StaticBasicParserPool pp = new StaticBasicParserPool();
        pp.setMaxPoolSize(50);
        try {
            pp.initialize();
        } catch (XMLParserException e) {
            throw new ConfigurationException("Error initializing parser pool", e);
        }
        Configuration.setParserPool(pp);
    }
View Full Code Here

    public void testIdpMetadataParsing_fromString() throws IOException {
        Saml2Client client = new Saml2Client();
        InputStream metaDataInputStream = getClass().getClassLoader().getResourceAsStream("testshib-providers.xml");
        String metadata = IOUtils.toString(metaDataInputStream, "UTF-8");
        client.setIdpMetadata(metadata);
        StaticBasicParserPool parserPool = client.newStaticBasicParserPool();
        AbstractMetadataProvider provider = client.idpMetadataProvider(parserPool);
        XMLObject md = client.getXmlObject(provider);
        String id = client.getIdpEntityId(md);
        assertEquals("https://idp.testshib.org/idp/shibboleth", id);
    }
View Full Code Here

    @Test
    public void testIdpMetadataParsing_fromFile() {
        Saml2Client client = new Saml2Client();
        client.setIdpMetadataPath("resource:testshib-providers.xml");
        StaticBasicParserPool parserPool = client.newStaticBasicParserPool();
        AbstractMetadataProvider provider = client.idpMetadataProvider(parserPool);
        XMLObject md = client.getXmlObject(provider);
        String id = client.getIdpEntityId(md);
        assertEquals("https://idp.testshib.org/idp/shibboleth", id);
    }
View Full Code Here

        } catch (ConfigurationException e) {
            throw new SamlException("Error bootstrapping OpenSAML", e);
        }

        // required parserPool for XML processing
        final StaticBasicParserPool parserPool = newStaticBasicParserPool();
        final AbstractMetadataProvider idpMetadataProvider = idpMetadataProvider(parserPool);

        final XMLObject md;
        try {
            md = idpMetadataProvider.getMetadata();
View Full Code Here

        return buildSaml2Credentials(context);

    }

    protected StaticBasicParserPool newStaticBasicParserPool() {
        StaticBasicParserPool parserPool = new StaticBasicParserPool();
        try {
            parserPool.initialize();
        } catch (XMLParserException e) {
            throw new SamlException("Error initializing parserPool", e);
        }
        return parserPool;
    }
View Full Code Here

            configurator.load(ins);
        }
    }
   
    protected static void initializeParserPool() throws ConfigurationException {
        StaticBasicParserPool pp = new StaticBasicParserPool();
        pp.setMaxPoolSize(50);
       
        Map<String, Boolean> features = new HashMap<String, Boolean>();
        features.put(XMLConstants.FEATURE_SECURE_PROCESSING, true);
        features.put("http://apache.org/xml/features/disallow-doctype-decl", true);
        pp.setBuilderFeatures(features);
        pp.setExpandEntityReferences(false);
       
        try {
            pp.initialize();
        } catch (XMLParserException e) {
            throw new ConfigurationException("Error initializing parser pool", e);
        }
        Configuration.setParserPool(pp);
    }
View Full Code Here

TOP

Related Classes of org.opensaml.xml.parse.StaticBasicParserPool

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.