Package org.opensaml.xml.io

Examples of org.opensaml.xml.io.Unmarshaller


    }
   
    /** {@inheritDoc} */
    protected void doInitialization() throws MetadataProviderException {
        try {
            Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(metadataElement);
            XMLObject metadataTemp = unmarshaller.unmarshall(metadataElement);
            filterMetadata(metadataTemp);
            releaseMetadataDOM(metadataTemp);
            metadata = metadataTemp;
            emitChangeEvent();
        } catch (UnmarshallingException e) {
View Full Code Here


            return null;
        } else {
            log.debug("Found a KeyInfo in form control data, extracting validation credentials");
        }

        Unmarshaller unmarshaller = Configuration.getUnmarshallerFactory()
                .getUnmarshaller(KeyInfo.DEFAULT_ELEMENT_NAME);
        if (unmarshaller == null) {
            throw new SecurityPolicyException("Could not obtain a KeyInfo unmarshaller");
        }

        ByteArrayInputStream is = new ByteArrayInputStream(Base64.decode(kiBase64));
        KeyInfo keyInfo = null;
        try {
            Document doc = parser.parse(is);
            keyInfo = (KeyInfo) unmarshaller.unmarshall(doc.getDocumentElement());
        } catch (XMLParserException e) {
            log.warn("Error parsing KeyInfo data", e);
            throw new SecurityPolicyException("Error parsing KeyInfo data", e);
        } catch (UnmarshallingException e) {
            log.warn("Error unmarshalling KeyInfo data", e);
View Full Code Here

     */
    public static XMLObject axisUnmarshall(Element element) throws UnmarshallingException {
        synchronized (lock) {
            XMLObject xmlObject;
            UnmarshallerFactory unmarshallerFactory = Configuration.getUnmarshallerFactory();
            Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(element);

            XMLObject xmlObjectDOM = unmarshaller.unmarshall(element);

            if (xmlObjectDOM instanceof PolicyType) {

                xmlObject = new PolicyTypeString((PolicyType) xmlObjectDOM);
                xmlObject.releaseDOM();
View Full Code Here

     * @throws UnmarshallingException
     */
    public static XMLObject unmarshall(Element element) throws UnmarshallingException {
        synchronized (lock) {
            UnmarshallerFactory unmarshallerFactory = Configuration.getUnmarshallerFactory();
            Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(element);
            XMLObject xmlObject = unmarshaller.unmarshall(element);
            return xmlObject;
        }
    }
View Full Code Here

        try {
            Document doc = parser.parse(BaseTestCase.class
                    .getResourceAsStream(elementFile));
            Element samlElement = doc.getDocumentElement();

            Unmarshaller unmarshaller = Configuration.getUnmarshallerFactory().getUnmarshaller(samlElement);
            if (unmarshaller == null) {
                fail("Unable to retrieve unmarshaller by DOM Element");
            }

            return unmarshaller.unmarshall(samlElement);
        } catch (XMLParserException e) {
            fail("Unable to parse element file " + elementFile);
        } catch (UnmarshallingException e) {
            fail("Unmarshalling failed when parsing element file " + elementFile + ": " + e);
        }
View Full Code Here

        stream.writeObject(assertionObject);

        ByteArrayInputStream inputStream = new ByteArrayInputStream(outStream.toByteArray());
        ObjectInputStream input = new ObjectInputStream(inputStream);

        Unmarshaller old = Configuration.getUnmarshallerFactory().getUnmarshaller(assertion.getElementQName());

        try {
            Configuration.getUnmarshallerFactory().deregisterUnmarshaller(assertion.getElementQName());
            SAMLBase o = (SAMLBase) input.readObject();
            o.getObject();
View Full Code Here

        stream.writeObject(assertionObject);

        ByteArrayInputStream inputStream = new ByteArrayInputStream(outStream.toByteArray());
        ObjectInputStream input = new ObjectInputStream(inputStream);

        Unmarshaller mock = createMock(Unmarshaller.class);
        Unmarshaller old = Configuration.getUnmarshallerFactory().getUnmarshaller(assertion.getElementQName());
        Configuration.getUnmarshallerFactory().registerUnmarshaller(assertion.getElementQName(), mock);

        expect(mock.unmarshall((Element) notNull())).andThrow(new UnmarshallingException(""));

        try {
View Full Code Here

            DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder();
            Document document = docBuilder.parse(new ByteArrayInputStream(omElement.toString().getBytes()));
            Element element = document.getDocumentElement();
            UnmarshallerFactory unmarshallerFactory = Configuration
                    .getUnmarshallerFactory();
            Unmarshaller unmarshaller = unmarshallerFactory
                    .getUnmarshaller(element);
            assertion = (org.opensaml.saml1.core.Assertion) unmarshaller
                    .unmarshall(element);
        } catch (Exception e){
            e.printStackTrace();
        }
        return  assertion;
View Full Code Here

            return null;
        } else {
            log.debug("Found a KeyInfo in form control data, extracting validation credentials");
        }

        Unmarshaller unmarshaller = Configuration.getUnmarshallerFactory()
                .getUnmarshaller(KeyInfo.DEFAULT_ELEMENT_NAME);
        if (unmarshaller == null) {
            throw new SecurityPolicyException("Could not obtain a KeyInfo unmarshaller");
        }

        ByteArrayInputStream is = new ByteArrayInputStream(Base64.decode(kiBase64));
        KeyInfo keyInfo = null;
        try {
            Document doc = parser.parse(is);
            keyInfo = (KeyInfo) unmarshaller.unmarshall(doc.getDocumentElement());
        } catch (XMLParserException e) {
            log.error("Error parsing KeyInfo data", e);
            throw new SecurityPolicyException("Error parsing KeyInfo data", e);
        } catch (UnmarshallingException e) {
            log.error("Error unmarshalling KeyInfo data", e);
View Full Code Here

        /** {@inheritDoc} */
        public SAMLObject getSamlMessage() {
            try {
                Element messageElem = parserPool.parse(new StringReader(serializedMessage)).getDocumentElement();
                Unmarshaller unmarshaller = Configuration.getUnmarshallerFactory().getUnmarshaller(messageElem);
                return (SAMLObject) unmarshaller.unmarshall(messageElem);
            } catch (Exception e) {
                log.error("Unable to deserialize and unmarshall SAML message associated with artifact " + artifact, e);
                return null;
            }
        }
View Full Code Here

TOP

Related Classes of org.opensaml.xml.io.Unmarshaller

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.