Prepare SAML Authentication request using OpenSaml3.1.1
Surinaidu Majji
pioneer.suri at gmail.com
Fri Jun 12 10:44:31 EDT 2015
Thanks for the reply Brent,
We are able to prepare AuthnRequest from AuhtenticationRequestBuilder as
per your suggestion but not able to Marshel it properly.
Please look into the following code:
OutputStream requestWriter = *new* OutputStream() {
@Override
*public* *void* write(*int* b) *throws* IOException {
// *TODO* Auto-generated method stub
}
};
org.opensaml.core.xml.io.MarshallerFactory marfact = *new*
org.opensaml.core.xml.io.MarshallerFactory();
Marshaller mar = marfact.getMarshaller(authnRequest);
org.w3c.dom.Element authDOM = mar.marshall(authnRequest);
SerializeSupport.*writeNode*(authDOM, requestWriter);
requestMessage = requestWriter.toString();
In the above code, we are getting "mar" as null.
Could you please help us to resolve it.
On Thu, Jun 11, 2015 at 11:18 PM, Brent Putman <putmanb at georgetown.edu>
wrote:
>
>
> On 6/11/15 1:23 AM, Surinaidu Majji wrote:
>
>
> A) base64 encoding/decoding packages in OpenSAML 3.1.1 (as highlighted
> below in red)
> B) XML helpers to convert DOM to Strings (as highlighted below in red)
>
> authDOM = marshaller.marshall(authnRequest); // converting to a DOM
> StringWriter requestWriter = new StringWriter();
> XMLHelper.writeNode(authDOM, requestWriter);
>
>
> See java-support,
> net.shibboleth.utilities.java.support.xml.SerializeSupport. One of the
> nodeToString(...) or writeNode(...) methods.
>
>
>
>
>
> encodedRequestMessage =
> Base64.encodeBytes(requestMessage.getBytes(),Base64.DONT_BREAK_LINES);
>
>
>
>
> Again java-support,
> net.shibboleth.utilities.java.support.codec.Base64Support.
>
>
> Although: I don't necessarily want to open a can of worms, but if what
> you're actually doing is trying to do is serialize and encode the data in
> order to implement SAML binding(s), we have higher level components in both
> v2 and v3 that do all that for you. In v3 for SAML 2, look at the
> MessageEncoder impls in the saml-impl module, package
> org.opensaml.saml.saml2.binding.encoding.impl. For usage examples, take a
> look at the unit tests for those. It's not difficult.
>
>
>
>
> --
> To unsubscribe from this list send an email to
> dev-unsubscribe at shibboleth.net
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shibboleth.net/pipermail/dev/attachments/20150612/982bacdd/attachment-0001.html>
More information about the dev
mailing list