/** * @param certificateId Alias of the certificate to be retrieved. * @param tenant The tenant where the key store file should be loaded from. * If the tenant is the super tenant, the primary key store will be used. * @return The certificate for the given alias */ @Override public X509Certificate getCertificate(String certificateId, Tenant tenant) throws CertificateRetrievingException { KeyStoreManager keyStoreManager = KeyStoreManager.getInstance(tenant.getId()); KeyStore keyStore; try { if (tenant.getId() != MultitenantConstants.SUPER_TENANT_ID) { // This is a tenant. So load the tenant key store. keyStore = keyStoreManager.getKeyStore(getKeyStoreName(tenant.getDomain())); } else { // This is the super tenant. So load the primary key store. keyStore = keyStoreManager.getPrimaryKeyStore(); } X509Certificate certificate = (X509Certificate) keyStore.getCertificate(certificateId); return certificate; } catch (Exception e) { String errorMsg = String.format("Error occurred while retrieving the certificate for the alias '%s' " + "of the tenant domain '%s'." + certificateId, tenant.getDomain()); throw new CertificateRetrievingException(errorMsg, e); } }
@Override public void execute() { String includeTableNames = this.getProperties().get(Constants.INCLUDE_TABLES); String[] includeTables = includeTableNames.split(Constants.INCLUDE_CLASS_SPLITTER); purge(includeTables, MultitenantConstants.SUPER_TENANT_ID); TenantManager tenantManager = AnalyticsServiceHolder.getRealmService().getTenantManager(); if (tenantManager != null) { try { Tenant[] allTenants = tenantManager.getAllTenants(); if (allTenants != null) { for (Tenant tenant : allTenants) { purge(includeTables, tenant.getId()); } } } catch (UserStoreException e) { logger.error("Unable to get tenant related information: " + e.getMessage(), e); } } }
/** * @param certificateId Alias of the certificate to be retrieved. * @param tenant The tenant where the key store file should be loaded from. * If the tenant is the super tenant, the primary key store will be used. * @return The certificate for the given alias */ @Override public X509Certificate getCertificate(String certificateId, Tenant tenant) throws CertificateRetrievingException { KeyStoreManager keyStoreManager = KeyStoreManager.getInstance(tenant.getId()); KeyStore keyStore; try { if (tenant.getId() != MultitenantConstants.SUPER_TENANT_ID) { // This is a tenant. So load the tenant key store. keyStore = keyStoreManager.getKeyStore(getKeyStoreName(tenant.getDomain())); } else { // This is the super tenant. So load the primary key store. keyStore = keyStoreManager.getPrimaryKeyStore(); } X509Certificate certificate = (X509Certificate) keyStore.getCertificate(certificateId); return certificate; } catch (Exception e) { String errorMsg = String.format("Error occurred while retrieving the certificate for the alias '%s' " + "of the tenant domain '%s'." + certificateId, tenant.getDomain()); throw new CertificateRetrievingException(errorMsg, e); } }
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(tenant.getId()); try { registry = IdentityMgtServiceComponent.getRegistryService().
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(tenant.getId()); try { registry = IdentityMgtServiceComponent.getRegistryService().
PrivilegedCarbonContext.startTenantFlow(); try { int tenantId = tenant.getId(); Date currentTime = indexingManager.getLastAccessTime(tenantId); indexingManager.setLastAccessTime(tenantId, submitResource(currentTime,