KeyInfoBuilder in OpenSAML 3

Stephen.CTR.Chappell at faa.gov Stephen.CTR.Chappell at faa.gov
Thu Jun 11 09:42:24 EDT 2015


Well that makes sense I think. So, more like this then?

XMLObjectBuilder<?> kiBuilder = builderFactory.getBuilder(KeyInfo.DEFAULT_ELEMENT_NAME);
ki = (KeyInfo) kiBuilder.buildObject(KeyInfo.DEFAULT_ELEMENT_NAME);


But I wouldn't have thought that based on the example Brent referenced ...

// Get the assertion builder based on the assertion element name
SAMLObjectBuilder<Assertion> builder = (SAMLObjectBuilder<Assertion>) builderFactory.getBuilder(Assertion.DEFAULT_ELEMENT_NAME);
 
// Create the assertion
Assertion assertion = builder.buildObject();


Stephen W. Chappell


-----Original Message-----
From: dev [mailto:dev-bounces at shibboleth.net] On Behalf Of Cantor, Scott
Sent: Thursday, June 11, 2015 9:31 AM
To: Shib Dev
Subject: Re: KeyInfoBuilder in OpenSAML 3

On 6/11/15, 12:37 PM, "Stephen.CTR.Chappell at faa.gov" 
<Stephen.CTR.Chappell at faa.gov> wrote:



>I’m not sure what you mean exactly by not making direct use of the 
>–Builders. I’m doing something like this:
> 
>XMLObjectProviderRegistry xmlObjectRegistry = 
>ConfigurationService.get(XMLObjectProviderRegistry.class);
>XMLObjectBuilderFactory builderFactory = 
>xmlObjectRegistry.getBuilderFactory();
>>KeyInfoBuilder kiBuilder = (KeyInfoBuilder) 
>builderFactory.getBuilder(KeyInfo.DEFAULT_ELEMENT_NAME);

Normally you don't cast the Builder itself, just the result. If you have a reference to an impl class, you're basically depending on code that's free to change at any time.

-- Scott

--
To unsubscribe from this list send an email to dev-unsubscribe at shibboleth.net


More information about the dev mailing list