Junit test for SAML Response from IDP
Msnaidu
pioneer.suri at gmail.com
Sun Dec 14 23:02:11 EST 2014
I wrote a method to parse the SAMLResponse from IDP, I have collected the
samlResponse by debugging my application
the same thing i am passing to the below code as an input:
public Response parseResponse(String responseMessage)
throws MarshallingException, IOException, XMLParserException,
MessageDecodingException {
String decodeResponse = decoder.decodeResponse(responseMessage);
log.debug("decoded Response : "+decodeResponse);
Document document = null;
Unmarshaller unmarshaller = null;
try {
BasicParserPool parserPoolManager = new BasicParserPool();
document = parserPoolManager.parse(new
ByteArrayInputStream(decodeResponse.getBytes()));
Element metadataRoot = document.getDocumentElement();
QName qName = new QName(metadataRoot.getNamespaceURI(),
metadataRoot.getLocalName(), metadataRoot.getPrefix());
**unmarshaller = Configuration.getUnmarshallerFactory()
.getUnmarshaller(qName);**
Response response = (Response) unmarshaller
.unmarshall(metadataRoot);
for (Assertion assertion : response.getAssertions()) {
// Processing here
}
} catch(Exception e) {
}
}
I am writing the junit test case for the above method, but it is not able to
unmarshall it.
The line "unmarshaller = Configuration.getUnmarshallerFactory()
.getUnmarshaller(qName);" is giving 'null'.
But the i have collected the input responseMessage from my application which
is real data.
I could not be able to run the test successfully even the code is working in
actual application.
--
View this message in context: http://shibboleth.1660669.n2.nabble.com/Junit-test-for-SAML-Response-from-IDP-tp7610062.html
Sent from the Shibboleth - Users mailing list archive at Nabble.com.
More information about the users
mailing list