Examples of SamlException


Examples of org.pac4j.saml.exceptions.SamlException

            for (AssertionConsumerService service : services) {
                if (acsIndex.equals(service.getIndex())) {
                    return service;
                }
            }
            throw new SamlException("Assertion consumer service with index " + acsIndex
                    + " could not be found for spDescriptor " + spDescriptor);
        }

        // Get default
        if (spDescriptor.getDefaultAssertionConsumerService() != null) {
            return spDescriptor.getDefaultAssertionConsumerService();
        }

        // Get first
        if (services.size() > 0) {
            return services.iterator().next();
        }

        throw new SamlException("No assertion consumer services could be found for " + spDescriptor);

    }
View Full Code Here

Examples of org.pac4j.saml.exceptions.SamlException

        try {
            entityDescriptor = this.metadata.getEntityDescriptor(this.spEntityId);
            roleDescriptor = this.metadata.getRole(this.spEntityId, SPSSODescriptor.DEFAULT_ELEMENT_NAME,
                    SAMLConstants.SAML20P_NS);
        } catch (MetadataProviderException e) {
            throw new SamlException("An error occured while getting SP descriptors", e);
        }

        if (entityDescriptor == null || roleDescriptor == null) {
            throw new SamlException("Cannot find entity " + this.spEntityId + " or role "
                    + SPSSODescriptor.DEFAULT_ELEMENT_NAME + " in metadata provider");
        }

        context.setLocalEntityMetadata(entityDescriptor);
        context.setLocalEntityRoleMetadata(roleDescriptor);
View Full Code Here

Examples of org.pac4j.saml.exceptions.SamlException

        try {
            entityDescriptor = this.metadata.getEntityDescriptor(this.idpEntityId);
            roleDescriptor = this.metadata.getRole(this.idpEntityId, IDPSSODescriptor.DEFAULT_ELEMENT_NAME,
                    SAMLConstants.SAML20P_NS);
        } catch (MetadataProviderException e) {
            throw new SamlException("An error occured while getting IDP descriptors", e);
        }

        if (entityDescriptor == null || roleDescriptor == null) {
            throw new SamlException("Cannot find entity " + this.idpEntityId + " or role "
                    + IDPSSODescriptor.DEFAULT_ELEMENT_NAME + " in metadata provider");
        }

        context.setPeerEntityMetadata(entityDescriptor);
        context.setPeerEntityRoleMetadata(roleDescriptor);
View Full Code Here

Examples of org.pac4j.saml.exceptions.SamlException

            CriteriaSet cs = new CriteriaSet();
            EntityIDCriteria criteria = new EntityIDCriteria(this.privateKey);
            cs.add(criteria);
            return this.credentialResolver.resolveSingle(cs);
        } catch (org.opensaml.xml.security.SecurityException e) {
            throw new SamlException("Can't obtain SP private key", e);
        }
    }
View Full Code Here

Examples of org.pac4j.saml.exceptions.SamlException

            KeyStore ks = KeyStore.getInstance("JKS");
            ks.load(inputStream, storePasswd == null ? null : storePasswd.toCharArray());
            return ks;
        } catch (Exception e) {
            this.logger.error("Error loading keystore", e);
            throw new SamlException("Error loading keystore", e);
        } finally {
            if (inputStream != null) {
                try {
                    inputStream.close();
                } catch (IOException e) {
View Full Code Here

Examples of org.pac4j.saml.exceptions.SamlException

        try {
            Enumeration<String> aliases = keyStore.aliases();
            if (aliases.hasMoreElements()) {
                return aliases.nextElement();
            } else {
                throw new SamlException("Keystore has no private keys");
            }
        } catch (KeyStoreException e) {
            throw new SamlException("Unable to get aliases from keyStore", e);
        }
    }
View Full Code Here

Examples of org.pac4j.saml.exceptions.SamlException

        try {
            KeyInfoGenerator keyInfoGenerator = SecurityHelper.getKeyInfoGenerator(credential, null,
                    Saml2Client.SAML_METADATA_KEY_INFO_GENERATOR);
            return keyInfoGenerator.generate(credential);
        } catch (org.opensaml.xml.security.SecurityException e) {
            throw new SamlException("Unable to generate keyInfo from given credential", e);
        }
    }
View Full Code Here

Examples of org.pac4j.saml.exceptions.SamlException

            X509KeyInfoGeneratorFactory generator = new X509KeyInfoGeneratorFactory();
            generator.setEmitEntityCertificate(true);
            generator.setEmitEntityCertificateChain(true);
            manager.registerFactory(Saml2Client.SAML_METADATA_KEY_INFO_GENERATOR, generator);
        } catch (ConfigurationException e) {
            throw new SamlException("Error bootstrapping OpenSAML", e);
        }

        // required parserPool for XML processing
        final StaticBasicParserPool parserPool = newStaticBasicParserPool();
        final AbstractMetadataProvider idpMetadataProvider = idpMetadataProvider(parserPool);

        final XMLObject md;
        try {
            md = idpMetadataProvider.getMetadata();
        } catch (MetadataProviderException e) {
            throw new SamlException("Error initializing idpMetadataProvider", e);
        }

        // If no idpEntityId declared, select first EntityDescriptor entityId as our IDP entityId
        if (this.idpEntityId == null) {
            this.idpEntityId = getIdpEntityId(md);
View Full Code Here

Examples of org.pac4j.saml.exceptions.SamlException

    protected StaticBasicParserPool newStaticBasicParserPool() {
        StaticBasicParserPool parserPool = new StaticBasicParserPool();
        try {
            parserPool.initialize();
        } catch (XMLParserException e) {
            throw new SamlException("Error initializing parserPool", e);
        }
        return parserPool;
    }
View Full Code Here

Examples of org.pac4j.saml.exceptions.SamlException

                idpMetadataProvider = new DOMMetadataProvider(metadataRoot);
            }
            idpMetadataProvider.setParserPool(parserPool);
            idpMetadataProvider.initialize();
        } catch (MetadataProviderException e) {
            throw new SamlException("Error initializing idpMetadataProvider", e);
        } catch (XMLParserException e) {
            throw new TechnicalException("Error parsing idp Metadata", e);
        } catch (ResourceException e) {
            throw new TechnicalException("Error getting idp Metadata resource", e);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.