net.shibboleth.utilities.java.support.resolver.ResolverException Java Examples

The following examples show how to use net.shibboleth.utilities.java.support.resolver.ResolverException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SamlHTTPMetadataResolver.java    From deprecated-security-advanced-modules with Apache License 2.0 6 votes vote down vote up
@Override
protected byte[] fetchMetadata() throws ResolverException {
    try {
        return AccessController.doPrivileged(new PrivilegedExceptionAction<byte[]>() {
            @Override
            public byte[] run() throws ResolverException {
                return SamlHTTPMetadataResolver.super.fetchMetadata();
            }
        });
    } catch (PrivilegedActionException e) {

        if (e.getCause() instanceof ResolverException) {
            throw (ResolverException) e.getCause();
        } else {
            throw new RuntimeException(e);
        }
    }
}
 
Example #2
Source File: SamlFilesystemMetadataResolver.java    From deprecated-security-advanced-modules with Apache License 2.0 6 votes vote down vote up
@Override
protected byte[] fetchMetadata() throws ResolverException {
    try {
        return AccessController.doPrivileged(new PrivilegedExceptionAction<byte[]>() {
            @Override
            public byte[] run() throws ResolverException {
                return SamlFilesystemMetadataResolver.super.fetchMetadata();
            }
        });
    } catch (PrivilegedActionException e) {

        if (e.getCause() instanceof ResolverException) {
            throw (ResolverException) e.getCause();
        } else {
            throw new RuntimeException(e);
        }
    }
}
 
Example #3
Source File: Saml2SettingsProvider.java    From deprecated-security-advanced-modules with Apache License 2.0 5 votes vote down vote up
Saml2Settings get() throws SamlConfigException {
    try {
        HashMap<String, Object> configProperties = new HashMap<>();

        EntityDescriptor entityDescriptor = this.metadataResolver
                .resolveSingle(new CriteriaSet(new EntityIdCriterion(this.idpEntityId)));

        if (entityDescriptor == null) {
            throw new SamlConfigException("Could not find entity descriptor for " + this.idpEntityId);
        }

        IDPSSODescriptor idpSsoDescriptor = entityDescriptor
                .getIDPSSODescriptor("urn:oasis:names:tc:SAML:2.0:protocol");

        if (idpSsoDescriptor == null) {
            throw new SamlConfigException("Could not find IDPSSODescriptor supporting SAML 2.0 in "
                    + this.idpEntityId + "; role descriptors: " + entityDescriptor.getRoleDescriptors());
        }

        initIdpEndpoints(idpSsoDescriptor, configProperties);
        initIdpCerts(idpSsoDescriptor, configProperties);

        initSpEndpoints(configProperties);

        initMisc(configProperties);

        SettingsBuilder settingsBuilder = new SettingsBuilder();

        // TODO allow overriding of IdP metadata?
        settingsBuilder.fromValues(configProperties);
        settingsBuilder.fromValues(new SamlSettingsMap(this.esSettings));

        return settingsBuilder.build();
    } catch (ResolverException e) {
        throw new AuthenticatorUnavailableException(e);
    }
}
 
Example #4
Source File: SyncopeWASAML2MetadataResolver.java    From syncope with Apache License 2.0 5 votes vote down vote up
@Override
protected byte[] fetchMetadata() throws ResolverException {
    try {
        SAML2SPMetadataService metadataService = restClient.getSyncopeClient().
            getService(SAML2SPMetadataService.class);
        SAML2SPMetadataTO metadataTO = metadataService.getByOwner(saml2Client.getName());
        return metadataTO.getMetadata().getBytes(StandardCharsets.UTF_8);
    } catch (final Exception e) {
        final String message = "Unable to fetch SP metadata for " + saml2Client.getName();
        LOG.error(message, e);
        throw new ResolverException(message);
    }
}