mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
scope-role-permission refactoring and webapp authorization
This commit is contained in:
parent
30a1d92fde
commit
c558cec88e
@ -599,19 +599,6 @@ public final class DeviceManagerUtil {
|
|||||||
return Caching.getCacheManagerFactory().getCacheManager(DeviceManagementConstants.DM_CACHE_MANAGER);
|
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
|
* Retrieve EventConfigurationProviderService osgi service component
|
||||||
* @return {@link EventConfigurationProviderService} service component
|
* @return {@link EventConfigurationProviderService} service component
|
||||||
@ -667,41 +654,15 @@ public final class DeviceManagerUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void initializeAPIResourcePermissionCache() {
|
public static void initializeAPIResourcePermissionCache() {
|
||||||
// DeviceManagementConfig config = DeviceConfigurationManager.getInstance().getDeviceManagementConfig();
|
|
||||||
// int deviceCacheExpiry = config.getDeviceCacheConfiguration().getExpiryTime();
|
|
||||||
// long deviceCacheCapacity = config.getDeviceCacheConfiguration().getCapacity();
|
|
||||||
CacheManager manager = getCacheManager();
|
CacheManager manager = getCacheManager();
|
||||||
// if (config.getDeviceCacheConfiguration().isEnabled()) {
|
if(!isAPIResourcePermissionCacheInitialized) {
|
||||||
if(!isDeviceCacheInitialized) {
|
isAPIResourcePermissionCacheInitialized = true;
|
||||||
isDeviceCacheInitialized = true;
|
|
||||||
if (manager != null) {
|
if (manager != null) {
|
||||||
// if (deviceCacheExpiry > 0) {
|
|
||||||
// manager.<DeviceCacheKey, Device>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.<DeviceCacheKey, Device>getCache(DeviceManagementConstants.DEVICE_CACHE)).
|
|
||||||
// setCapacity(deviceCacheCapacity);
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
manager.<DeviceCacheKey, Device>getCache(DeviceManagementConstants.API_RESOURCE_PERMISSION_CACHE);
|
manager.<DeviceCacheKey, Device>getCache(DeviceManagementConstants.API_RESOURCE_PERMISSION_CACHE);
|
||||||
// }
|
|
||||||
} else {
|
} else {
|
||||||
// if (deviceCacheExpiry > 0) {
|
|
||||||
// Caching.getCacheManager().
|
|
||||||
// <DeviceCacheKey, Device>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.<DeviceCacheKey, Device>getCache(DeviceManagementConstants.DEVICE_CACHE))).
|
|
||||||
// setCapacity(deviceCacheCapacity);
|
|
||||||
// } else {
|
|
||||||
Caching.getCacheManager().<DeviceCacheKey, Device>getCache(DeviceManagementConstants.API_RESOURCE_PERMISSION_CACHE);
|
Caching.getCacheManager().<DeviceCacheKey, Device>getCache(DeviceManagementConstants.API_RESOURCE_PERMISSION_CACHE);
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -764,10 +725,8 @@ public final class DeviceManagerUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Cache<APIResourcePermissionCacheKey, List<Permission>> getAPIResourcePermissionCache() {
|
public static Cache<APIResourcePermissionCacheKey, List<Permission>> getAPIResourcePermissionCache() {
|
||||||
// DeviceManagementConfig config = DeviceConfigurationManager.getInstance().getDeviceManagementConfig();
|
|
||||||
CacheManager manager = getCacheManager();
|
CacheManager manager = getCacheManager();
|
||||||
Cache<APIResourcePermissionCacheKey, List<Permission>> apiResourcePermissionCache = null;
|
Cache<APIResourcePermissionCacheKey, List<Permission>> apiResourcePermissionCache = null;
|
||||||
// if (config.getDeviceCacheConfiguration().isEnabled()) {
|
|
||||||
if(!isAPIResourcePermissionCacheInitialized) {
|
if(!isAPIResourcePermissionCacheInitialized) {
|
||||||
initializeAPIResourcePermissionCache();
|
initializeAPIResourcePermissionCache();
|
||||||
}
|
}
|
||||||
@ -777,7 +736,6 @@ public final class DeviceManagerUtil {
|
|||||||
apiResourcePermissionCache = Caching.getCacheManager(DeviceManagementConstants.DM_CACHE_MANAGER)
|
apiResourcePermissionCache = Caching.getCacheManager(DeviceManagementConstants.DM_CACHE_MANAGER)
|
||||||
.getCache(DeviceManagementConstants.API_RESOURCE_PERMISSION_CACHE);
|
.getCache(DeviceManagementConstants.API_RESOURCE_PERMISSION_CACHE);
|
||||||
}
|
}
|
||||||
// }
|
|
||||||
return apiResourcePermissionCache;
|
return apiResourcePermissionCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -114,9 +114,6 @@
|
|||||||
org.wso2.carbon.base,
|
org.wso2.carbon.base,
|
||||||
org.owasp.encoder
|
org.owasp.encoder
|
||||||
</Import-Package>
|
</Import-Package>
|
||||||
<!--<Embed-Dependency>-->
|
|
||||||
<!--tomcat-coyote,-->
|
|
||||||
<!--</Embed-Dependency>-->
|
|
||||||
</instructions>
|
</instructions>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
@ -199,18 +196,12 @@
|
|||||||
<artifactId>org.wso2.carbon.identity.oauth</artifactId>
|
<artifactId>org.wso2.carbon.identity.oauth</artifactId>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<!--<dependency>-->
|
|
||||||
<groupId>org.wso2.orbit.com.nimbusds</groupId>
|
<groupId>org.wso2.orbit.com.nimbusds</groupId>
|
||||||
<artifactId>nimbus-jose-jwt</artifactId>
|
<artifactId>nimbus-jose-jwt</artifactId>
|
||||||
<!--</dependency>-->
|
|
||||||
</exclusion>
|
</exclusion>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<!--<dependency>-->
|
|
||||||
<groupId>com.nimbusds</groupId>
|
<groupId>com.nimbusds</groupId>
|
||||||
<artifactId>nimbus-jose-jwt</artifactId>
|
<artifactId>nimbus-jose-jwt</artifactId>
|
||||||
<!--<version>9.10</version>-->
|
|
||||||
<!--</dependency>-->
|
|
||||||
|
|
||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user