Examples of IdentitySAML2SSOException


Examples of org.wso2.carbon.identity.sso.saml.exception.IdentitySAML2SSOException

            try {
                tenantID = realmService.getTenantManager().getTenantId(domainName);
            } catch (org.wso2.carbon.user.api.UserStoreException e) {
                String errorMsg = "Error getting the TenantID for the domain name";
                log.error(errorMsg, e);
                throw new IdentitySAML2SSOException(errorMsg, e);
            }
        }

        KeyStoreManager keyStoreManager;
        try {
            // get an instance of the corresponding Key Store Manager instance
            keyStoreManager = KeyStoreManager.getInstance(registryService.getGovernanceSystemRegistry(tenantID));
        } catch (RegistryException e) {
            String errorMsg = "Error getting a KeyStore Manager instance.";
            log.error(errorMsg, e);
            throw new IdentitySAML2SSOException(errorMsg, e);
        }

        X509CredentialImpl credentialImpl = null;
        KeyStore keyStore;

        try {
            if (tenantID != 0) {    // for non zero tenants, load private key from their generated key store
                keyStore = keyStoreManager.getKeyStore(generateKSNameFromDomainName(domainName));
            } else {    // for tenant zero, load the default pub. cert using the config. in carbon.xml
                keyStore = keyStoreManager.getPrimaryKeyStore();
            }
            java.security.cert.X509Certificate cert =  (java.security.cert.X509Certificate) keyStore.getCertificate(alias);
            credentialImpl = new X509CredentialImpl(cert);

        } catch (Exception e) {
            String errorMsg = "Error instantiating an X509CredentialImpl object for the public cert.";
            log.error(errorMsg, e);
            throw new IdentitySAML2SSOException(errorMsg, e);
        }
        return credentialImpl;
    }
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.