use of org.opensaml.xml.io.UnmarshallerFactory in project cloudstack by apache.
the class SAMLUtils method decodeSAMLResponse.
public static Response decodeSAMLResponse(String responseMessage) throws ConfigurationException, ParserConfigurationException, SAXException, IOException, UnmarshallingException {
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setNamespaceAware(true);
DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder();
byte[] base64DecodedResponse = Base64.decode(responseMessage);
Document document = docBuilder.parse(new ByteArrayInputStream(base64DecodedResponse));
Element element = document.getDocumentElement();
UnmarshallerFactory unmarshallerFactory = Configuration.getUnmarshallerFactory();
Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(element);
return (Response) unmarshaller.unmarshall(element);
}
use of org.opensaml.xml.io.UnmarshallerFactory in project OpenAttestation by OpenAttestation.
the class TrustAssertion method readAssertion.
private Assertion readAssertion(Element document) throws UnmarshallingException {
log.debug("Reading assertion from element {}", document.getTagName());
UnmarshallerFactory factory = Configuration.getUnmarshallerFactory();
Unmarshaller unmarshaller = factory.getUnmarshaller(document);
// UnmarshallingException
XMLObject xml = unmarshaller.unmarshall(document);
Assertion samlAssertion = (Assertion) xml;
return samlAssertion;
}
Aggregations