use of org.wso2.carbon.identity.application.common.model.xsd.ServiceProvider in project carbon-identity-framework by wso2.
the class CacheBackedApplicationDAO method deleteApplication.
public void deleteApplication(String applicationName) throws IdentityApplicationManagementException {
String tenantDomain = CarbonContext.getThreadLocalCarbonContext().getTenantDomain();
ServiceProvider serviceProvider = getApplication(applicationName, tenantDomain);
clearAllAppCache(serviceProvider, tenantDomain);
appDAO.deleteApplication(applicationName);
}
use of org.wso2.carbon.identity.application.common.model.xsd.ServiceProvider in project carbon-identity-framework by wso2.
the class CacheBackedApplicationDAO method updateApplicationByResourceId.
@Override
public void updateApplicationByResourceId(String resourceId, String tenantDomain, ServiceProvider updatedApp) throws IdentityApplicationManagementException {
ServiceProvider storedApp = getApplicationByResourceId(resourceId, tenantDomain);
clearAllAppCache(storedApp, tenantDomain);
appDAO.updateApplicationByResourceId(resourceId, tenantDomain, updatedApp);
}
use of org.wso2.carbon.identity.application.common.model.xsd.ServiceProvider in project carbon-identity-framework by wso2.
the class CacheBackedApplicationDAO method getApplication.
public ServiceProvider getApplication(int appId) throws IdentityApplicationManagementException {
ServiceProvider serviceProvider = getApplicationFromCache(appId, CarbonContext.getThreadLocalCarbonContext().getTenantDomain());
if (serviceProvider == null) {
serviceProvider = appDAO.getApplication(appId);
if (serviceProvider == null) {
throw new IdentityApplicationManagementException("Error while getting the service provider for appId: " + appId);
}
addToCache(serviceProvider, serviceProvider.getOwner().getTenantDomain());
}
return serviceProvider;
}
use of org.wso2.carbon.identity.application.common.model.xsd.ServiceProvider in project carbon-identity-framework by wso2.
the class CacheBackedApplicationDAO method clearAppCacheByInboundKey.
private static void clearAppCacheByInboundKey(ServiceProvider serviceProvider, String tenantDomain) {
if (serviceProvider.getInboundAuthenticationConfig() != null && serviceProvider.getInboundAuthenticationConfig().getInboundAuthenticationRequestConfigs() != null) {
InboundAuthenticationRequestConfig[] configs = serviceProvider.getInboundAuthenticationConfig().getInboundAuthenticationRequestConfigs();
for (InboundAuthenticationRequestConfig config : configs) {
if (config.getInboundAuthKey() != null) {
ServiceProviderCacheInboundAuthKey clientKey = new ServiceProviderCacheInboundAuthKey(config.getInboundAuthKey(), config.getInboundAuthType());
appCacheByInboundAuth.clearCacheEntry(clientKey, tenantDomain);
}
}
}
}
use of org.wso2.carbon.identity.application.common.model.xsd.ServiceProvider in project carbon-identity-framework by wso2.
the class CacheBackedApplicationDAO method addToCache.
private void addToCache(ServiceProvider serviceProvider, String tenantDomain) {
if (log.isDebugEnabled()) {
log.debug("Add cache for the application " + serviceProvider.getApplicationName() + "@" + tenantDomain);
}
IdentityServiceProviderCacheKey nameKey = new IdentityServiceProviderCacheKey(serviceProvider.getApplicationName());
IdentityServiceProviderCacheEntry nameEntry = new IdentityServiceProviderCacheEntry(serviceProvider);
appCacheByName.addToCache(nameKey, nameEntry, tenantDomain);
ServiceProviderIDCacheKey idKey = new ServiceProviderIDCacheKey(serviceProvider.getApplicationID());
ServiceProviderIDCacheEntry idEntry = new ServiceProviderIDCacheEntry(serviceProvider);
appCacheByID.addToCache(idKey, idEntry, tenantDomain);
ServiceProviderResourceIdCacheKey resourceIdCacheKey = new ServiceProviderResourceIdCacheKey(serviceProvider.getApplicationResourceId());
ServiceProviderResourceIdCacheEntry entry = new ServiceProviderResourceIdCacheEntry(serviceProvider);
appCacheByResourceId.addToCache(resourceIdCacheKey, entry, tenantDomain);
if (serviceProvider.getInboundAuthenticationConfig() != null && serviceProvider.getInboundAuthenticationConfig().getInboundAuthenticationRequestConfigs() != null) {
InboundAuthenticationRequestConfig[] configs = serviceProvider.getInboundAuthenticationConfig().getInboundAuthenticationRequestConfigs();
for (InboundAuthenticationRequestConfig config : configs) {
if (config.getInboundAuthKey() != null) {
ServiceProviderCacheInboundAuthKey clientKey = new ServiceProviderCacheInboundAuthKey(config.getInboundAuthKey(), config.getInboundAuthType());
ServiceProviderCacheInboundAuthEntry clientEntry = new ServiceProviderCacheInboundAuthEntry(serviceProvider.getApplicationName(), tenantDomain);
appCacheByInboundAuth.addToCache(clientKey, clientEntry, tenantDomain);
}
}
}
}
Aggregations