Marshalling RequestSecurityToken
Brent Putman
putmanb at georgetown.edu
Thu Mar 15 21:52:56 GMT 2012
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
More information about the dev
mailing list