From c558cec88e8c7aa44f8e809fd02bfff36f83ee0f Mon Sep 17 00:00:00 2001 From: Amalka Subasinghe Date: Sat, 26 Jun 2021 13:53:33 +0530 Subject: [PATCH] scope-role-permission refactoring and webapp authorization --- .../mgt/core/util/DeviceManagerUtil.java | 46 +------------------ .../pom.xml | 9 ---- 2 files changed, 2 insertions(+), 53 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/DeviceManagerUtil.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/DeviceManagerUtil.java index 4415acec60..f83e19c62f 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/DeviceManagerUtil.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/DeviceManagerUtil.java @@ -599,19 +599,6 @@ public final class DeviceManagerUtil { return Caching.getCacheManagerFactory().getCacheManager(DeviceManagementConstants.DM_CACHE_MANAGER); } - //todo:amalka -// public static EventsPublisherService getEventPublisherService() { -// PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); -// EventsPublisherService eventsPublisherService = -// (EventsPublisherService) ctx.getOSGiService(EventsPublisherService.class, null); -// if (eventsPublisherService == null) { -// String msg = "Event Publisher service has not initialized."; -// log.error(msg); -// throw new IllegalStateException(msg); -// } -// return eventsPublisherService; -// } - /** * Retrieve EventConfigurationProviderService osgi service component * @return {@link EventConfigurationProviderService} service component @@ -667,41 +654,15 @@ public final class DeviceManagerUtil { } public static void initializeAPIResourcePermissionCache() { -// DeviceManagementConfig config = DeviceConfigurationManager.getInstance().getDeviceManagementConfig(); -// int deviceCacheExpiry = config.getDeviceCacheConfiguration().getExpiryTime(); -// long deviceCacheCapacity = config.getDeviceCacheConfiguration().getCapacity(); CacheManager manager = getCacheManager(); -// if (config.getDeviceCacheConfiguration().isEnabled()) { - if(!isDeviceCacheInitialized) { - isDeviceCacheInitialized = true; + if(!isAPIResourcePermissionCacheInitialized) { + isAPIResourcePermissionCacheInitialized = true; if (manager != null) { -// if (deviceCacheExpiry > 0) { -// manager.createCacheBuilder(DeviceManagementConstants.DEVICE_CACHE). -// setExpiry(CacheConfiguration.ExpiryType.MODIFIED, new CacheConfiguration.Duration(TimeUnit.SECONDS, -// deviceCacheExpiry)).setExpiry(CacheConfiguration.ExpiryType.ACCESSED, new CacheConfiguration. -// Duration(TimeUnit.SECONDS, deviceCacheExpiry)).setStoreByValue(true).build(); -// if(deviceCacheCapacity > 0 ) { -// ((CacheImpl) manager.getCache(DeviceManagementConstants.DEVICE_CACHE)). -// setCapacity(deviceCacheCapacity); -// } -// } else { manager.getCache(DeviceManagementConstants.API_RESOURCE_PERMISSION_CACHE); -// } } else { -// if (deviceCacheExpiry > 0) { -// Caching.getCacheManager(). -// createCacheBuilder(DeviceManagementConstants.DEVICE_CACHE). -// setExpiry(CacheConfiguration.ExpiryType.MODIFIED, new CacheConfiguration.Duration(TimeUnit.SECONDS, -// deviceCacheExpiry)).setExpiry(CacheConfiguration.ExpiryType.ACCESSED, new CacheConfiguration. -// Duration(TimeUnit.SECONDS, deviceCacheExpiry)).setStoreByValue(true).build(); -// ((CacheImpl)(manager.getCache(DeviceManagementConstants.DEVICE_CACHE))). -// setCapacity(deviceCacheCapacity); -// } else { Caching.getCacheManager().getCache(DeviceManagementConstants.API_RESOURCE_PERMISSION_CACHE); -// } } } -// } } /** @@ -764,10 +725,8 @@ public final class DeviceManagerUtil { } public static Cache> getAPIResourcePermissionCache() { -// DeviceManagementConfig config = DeviceConfigurationManager.getInstance().getDeviceManagementConfig(); CacheManager manager = getCacheManager(); Cache> apiResourcePermissionCache = null; -// if (config.getDeviceCacheConfiguration().isEnabled()) { if(!isAPIResourcePermissionCacheInitialized) { initializeAPIResourcePermissionCache(); } @@ -777,7 +736,6 @@ public final class DeviceManagerUtil { apiResourcePermissionCache = Caching.getCacheManager(DeviceManagementConstants.DM_CACHE_MANAGER) .getCache(DeviceManagementConstants.API_RESOURCE_PERMISSION_CACHE); } -// } return apiResourcePermissionCache; } diff --git a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml index a7d96cbd94..2bf0318675 100644 --- a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml +++ b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml @@ -114,9 +114,6 @@ org.wso2.carbon.base, org.owasp.encoder - - - @@ -199,18 +196,12 @@ org.wso2.carbon.identity.oauth - org.wso2.orbit.com.nimbusds nimbus-jose-jwt - - com.nimbusds nimbus-jose-jwt - - -