OpenSAML3.3 Correct way to read (adfs) FederationService.xml?
Rob Audenaerde
rob.audenaerde at gmail.com
Tue May 23 12:48:44 EDT 2017
Ah I see. Thanks!
The complete snippet is now working:
InitializationService.initialize();
FilesystemMetadataResolver idpMetaDataProvider = new
FilesystemMetadataResolver( new File(
"/home/raudenaerde/sso/FederationMetadata.xml" ) );
idpMetaDataProvider.setRequireValidMetadata( true );
idpMetaDataProvider.setId( "myId" );
BasicParserPool pool = new BasicParserPool();
pool.initialize();
idpMetaDataProvider.setParserPool( pool );
idpMetaDataProvider.initialize();
for ( EntityDescriptor idpEntityDescriptor : idpMetaDataProvider )
{
System.out.println( idpEntityDescriptor.getID() );
for ( SingleSignOnService sss : idpEntityDescriptor.getIDPSSODescriptor(
SAMLConstants.SAML20P_NS ).getSingleSignOnServices() )
{
if ( sss.getBinding().equals( SAMLConstants.SAML2_REDIRECT_BINDING_URI ) )
{
System.out.println( sss.getLocation() );
}
}
for ( ArtifactResolutionService ars :
idpEntityDescriptor.getIDPSSODescriptor( SAMLConstants.SAML20P_NS
).getArtifactResolutionServices() )
{
if ( ars.getBinding().equals( SAMLConstants.SAML2_SOAP11_BINDING_URI ) )
{
System.out.println( ars.getLocation() );
}
}
}
On Tue, May 23, 2017 at 6:27 PM, Brent Putman <putmanb at georgetown.edu>
wrote:
>
>
> On 5/23/17 12:17 PM, Rob Audenaerde wrote:
>
>
> Actually, I already tried setting an ID just before initialize(). It gave
> me an exception which was ultimately caused by:
>
>
> Well, that's not what was giving you the exception. You do definitely
> need to set that ID. That has just allowed the code to proceed past that
> point, leading you to another issue...
>
>
>
> Caused by: net.shibboleth.utilities.java.support.component.
> UninitializedComponentException: Component has not yet been initialized
> and cannot be used.
> at net.shibboleth.utilities.java.support.component.ComponentSupport.
> ifNotInitializedThrowUninitializedComponentException(
> ComponentSupport.java:111)
> at net.shibboleth.utilities.java.support.xml.BasicParserPool.
> checkInitializedNotDestroyed(BasicParserPool.java:643)
> at net.shibboleth.utilities.java.support.xml.BasicParserPool.
> parse(BasicParserPool.java:237)
> at org.opensaml.saml.metadata.resolver.impl.AbstractMetadataResolver.
> unmarshallMetadata(AbstractMetadataResolver.java:341)
> ... 7 more
>
>
> As you can see, that's originally being thrown by the BasicParserPool.
> That also needs to be initialize()-ed before it can be used.
>
> Generally, you don't want to new() a new parser pool every time you need
> one. You create 1 instance (and initialize() it), and reuse it. If you
> were using dependency injection/IoC, you'd just wire 1 instance up and
> inject it where needed. If you aren't using that development style, and
> don't have any special requirements for the parser pool, then you can just
> use the global instance that exists after InitializationService.initialize()
> is called. It will be available from org.opensaml.core.xml.config.
> XMLObjectProviderRegistrySupport.getParserPool().
>
>
>
>
>
> --
> 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/20170523/64415a9a/attachment.html>
More information about the dev
mailing list