Marshalling RequestSecurityToken
Gina Choi
gchoi at sdl.com
Fri Mar 16 15:00:48 GMT 2012
Hi Brent,
Thanks for providing me temp fix for marshaling issue. I really appreciate
your quick fix. It worked. I built following RequestSecurityToken using
openws. I know that I need to add some more content and try to figure it out.
<?xml version="1.0" encoding="UTF-8"?>
<wst:RequestSecurityToken
xmlns:wst="http://docs.oasis-open.org/ws-sx/ws-trust/200512">
<wsp:AppliesTo
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
<wsa:EndpointReference
xmlns:wsa="http://www.w3.org/2005/08/addressing">
<wsa:Address>https://yourcompany.com</wsa:Address>
</wsa:EndpointReference>
</wsp:AppliesTo>
<wst:KeyType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/Bearer</wst:Key
Type>
<wst:RequestType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/Issue</wst:
RequestType>
<wst:TokenType>urn:oasis:names:tc:SAML:2.0:assertion</wst:TokenType>
<wsu:Timestamp
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity
-utility-1.0.xsd">
<wsu:Created>2012-03-16T14:06:01.067Z</wsu:Created>
</wsu:Timestamp>
</wst:RequestSecurityToken>
I used following code to build RequestSecurityToken(Please let me know if I
am in wrong direction). In same way, I was able to find corresponding
builders for each element inside RequestSecurityToken.
//Build RequestSecurityToken
RequestSecurityTokenBuilder rstBuilder = new
RequestSecurityTokenBuilder();
RequestSecurityToken rst= rstBuilder.buildObject();
//Build AppliesTo and add it to RST
AppliesToBuilder appliesToBuilder = new AppliesToBuilder();
AppliesTo appliesTo = appliesToBuilder.buildObject();
rst.getUnknownXMLObjects().add(appliesTo);
I guess next step is that I need to put this RST inside SOAP envelope, but I
haven't deal with SOAP much before. Any ideas?
Thanks.
Gina
------------------------------
Message: 2
Date: Thu, 15 Mar 2012 08:03:59 -1200
From: Gina Choi <gchoi at sdl.com>
Subject: Marshalling RequestSecurityToken
To: <dev at shibboleth.net>, <putmanb at georgetown.edu>
Message-ID:
<199C35CD64E44140A34EB403EA9F70736228AB at wakemail0303.global.sdl.corp>
Content-Type: text/plain; charset="us-ascii"
Hi Brent,
Per your direction, I check out unit tests for openws and they were very
helpful. Now, I have RequestSecurityToken object and need to marshal it. When
I marshal AuthnRequest I used following code, but if I pass
RequestSecurityToken to the following code, it returns null(marshaller ==
null).
Marshaller marshaller = org.opensaml.Configuration
.getMarshallerFactory().getMarshaller(authnRequest);
Do we marshal RequestSecurityToken in different way?
Thanks.
Gina Choi
------------------------------
Message: 3
Date: Thu, 15 Mar 2012 17:52:56 -0400
From: Brent Putman <putmanb at georgetown.edu>
Subject: Re: Marshalling RequestSecurityToken
To: dev at shibboleth.net
Message-ID: <4F6264B8.6020500 at georgetown.edu>
Content-Type: text/plain; charset=ISO-8859-1
On 3/15/12 4:03 PM, Gina Choi wrote:
> Hi Brent,
>
> Per your direction, I check out unit tests for openws and they were very
> helpful. Now, I have RequestSecurityToken object and need to marshal it.
When
> I marshal AuthnRequest I used following code, but if I pass
> RequestSecurityToken to the following code, it returns null(marshaller ==
> null).
>
>
> Marshaller marshaller = org.opensaml.Configuration
>
> .getMarshallerFactory().getMarshaller(authnRequest);
>
>
> Do we marshal RequestSecurityToken in different way?
>
No, it's actually the same for any of the XMLObjects. I looked into it,
and it appears we have a small bug. Somehow we never registered the
WS-Trust and WS-Policy schema configs into the DefaultBootstrap process,
so those providers aren't being configured when you run
DefaultBootstrap.bootstrap().
I will fix this for the next release, but in the meantime you can just
manually load them. Wherever you are calling DefaultBootstrap, just add
some calls to load the configs explicitly, after you call bootstrap(),
similar to this:
DefaultBootstrap.bootstrap();
XMLConfigurator configurator = new XMLConfigurator();
InputStream isTrust =
Configuration.class.getResourceAsStream("/wstrust-config.xml");
configurator.load(isTrust);
InputStream isPolicy =
Configuration.class.getResourceAsStream("/wspolicy-config.xml");
configurator.load(isPolicy);
That begs the question however of how you were able build the RST object
in the first place, since you couldn't have been getting a builder for
it. You must be just new()-ing the -Impl class directly, which we don't
advise or support. You should really be getting the new instance via a
Builder, otherwise your code might break if we change something up in
the future with how the library works.
--Brent
------------------------------
--
To unsubscribe from this list send an email to dev-unsubscribe at shibboleth.net
End of dev Digest, Vol 9, Issue 12
**********************************
More information about the dev
mailing list