*/
public static X509CredentialImpl getX509CredentialImplForTenant(String domainName)
throws SAML2SSOAuthenticatorException {
int tenantID = 0;
RegistryService registryService = SAML2SSOAuthBEDataHolder.getInstance().getRegistryService();
RealmService realmService = SAML2SSOAuthBEDataHolder.getInstance().getRealmService();
// get the tenantID
if (domainName != null) {
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 SAML2SSOAuthenticatorException(errorMsg, e);
}
}
KeyStoreManager keyStoreManager = null;
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 SAML2SSOAuthenticatorException(errorMsg, e);
}