KeyInfoBuilder in OpenSAML 3

Cantor, Scott cantor.2 at osu.edu
Thu Jun 11 09:47:51 EDT 2015


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



>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);

Yes, or cast to the SAMLObjectBuilder specialization, but same difference.

>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();

See above, that's using a genericized interface to eliminate a cast later. 
It's either a cast first or a cast second.

-- Scott

>


More information about the dev mailing list