Switching code to SecretManagerProvider
This commit is contained in:
parent
c0cca0aa07
commit
f797247c5f
|
@ -3,7 +3,7 @@ package org.gcube.gcat.configuration;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.common.authorization.utils.manager.SecretManager;
|
||||
import org.gcube.common.authorization.utils.manager.SecretManagerProvider;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
|
@ -22,7 +22,7 @@ public class CatalogueConfigurationFactory {
|
|||
}
|
||||
|
||||
public synchronized static ServiceCatalogueConfiguration getInstance() {
|
||||
String context = SecretManager.instance.get().getContext();
|
||||
String context = SecretManagerProvider.instance.get().getContext();
|
||||
ServiceCatalogueConfiguration catalogueConfiguration = catalogueConfigurations.get(context);
|
||||
if(catalogueConfiguration == null) {
|
||||
catalogueConfiguration = load(context);
|
||||
|
@ -32,7 +32,7 @@ public class CatalogueConfigurationFactory {
|
|||
}
|
||||
|
||||
public synchronized static void renew() {
|
||||
String context = SecretManager.instance.get().getContext();
|
||||
String context = SecretManagerProvider.instance.get().getContext();
|
||||
catalogueConfigurations.remove(context);
|
||||
ServiceCatalogueConfiguration catalogueConfiguration = load(context);
|
||||
catalogueConfigurations.put(context, catalogueConfiguration);
|
||||
|
@ -40,14 +40,14 @@ public class CatalogueConfigurationFactory {
|
|||
|
||||
public synchronized static void purge() {
|
||||
// Remove the resource from IS
|
||||
String context = SecretManager.instance.get().getContext();
|
||||
String context = SecretManagerProvider.instance.get().getContext();
|
||||
catalogueConfigurations.remove(context);
|
||||
GCoreISConfigurationProxy gCoreISConfigurationProxy = new GCoreISConfigurationProxy(context);
|
||||
gCoreISConfigurationProxy.delete();
|
||||
}
|
||||
|
||||
public synchronized static ServiceCatalogueConfiguration createOrUpdate(ServiceCatalogueConfiguration catalogueConfiguration) throws Exception {
|
||||
String context = SecretManager.instance.get().getContext();
|
||||
String context = SecretManagerProvider.instance.get().getContext();
|
||||
catalogueConfigurations.remove(context);
|
||||
GCoreISConfigurationProxy gCoreISConfigurationProxy = new GCoreISConfigurationProxy(context, catalogueConfiguration);
|
||||
catalogueConfiguration = gCoreISConfigurationProxy.createOrUpdateOnIS();
|
||||
|
|
|
@ -21,7 +21,7 @@ import org.gcube.com.fasterxml.jackson.databind.JsonNode;
|
|||
import org.gcube.com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.gcube.com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
import org.gcube.com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import org.gcube.common.authorization.utils.manager.SecretManager;
|
||||
import org.gcube.common.authorization.utils.manager.SecretManagerProvider;
|
||||
import org.gcube.common.resources.gcore.GenericResource;
|
||||
import org.gcube.common.resources.gcore.ServiceEndpoint;
|
||||
import org.gcube.common.resources.gcore.ServiceEndpoint.AccessPoint;
|
||||
|
@ -166,7 +166,7 @@ public class GCoreISConfigurationProxy {
|
|||
*/
|
||||
private List<ServiceEndpoint> getServiceEndpoints(String category, String name) {
|
||||
SimpleQuery query = queryFor(ServiceEndpoint.class);
|
||||
query.addCondition("$resource/Scopes/Scope/text() eq '" + SecretManager.instance.get().getContext() + "'");
|
||||
query.addCondition("$resource/Scopes/Scope/text() eq '" + SecretManagerProvider.instance.get().getContext() + "'");
|
||||
query.addCondition("$resource/Profile/Category/text() eq '" + category + "'");
|
||||
query.addCondition("$resource/Profile/Name/text() eq '" + name + "'");
|
||||
DiscoveryClient<ServiceEndpoint> client = clientFor(ServiceEndpoint.class);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.gcube.gcat.moderation.thread;
|
||||
|
||||
import org.gcube.common.authorization.utils.manager.SecretManager;
|
||||
import org.gcube.common.authorization.utils.manager.SecretManagerProvider;
|
||||
import org.gcube.gcat.api.moderation.CMItemStatus;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -21,7 +21,7 @@ public class FakeModerationThread extends ModerationThread {
|
|||
@Override
|
||||
public void postUserMessage(CMItemStatus cmItemStatus, String userMessage) throws Exception {
|
||||
logger.info("{} is sending a message to the {} for item '{}' (id={}). ItemStatus={}, Message=\"{}\"",
|
||||
SecretManager.instance.get().getUser().getUsername(),
|
||||
SecretManagerProvider.instance.get().getUser().getUsername(),
|
||||
ModerationThread.class.getSimpleName(), itemName, itemID, cmItemStatus, userMessage);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ import org.gcube.com.fasterxml.jackson.databind.JsonNode;
|
|||
import org.gcube.com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
import org.gcube.com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import org.gcube.common.authorization.utils.manager.SecretManager;
|
||||
import org.gcube.common.authorization.utils.manager.SecretManagerProvider;
|
||||
import org.gcube.common.authorization.utils.secret.Secret;
|
||||
import org.gcube.gcat.api.moderation.CMItemStatus;
|
||||
import org.gcube.gcat.api.moderation.Moderated;
|
||||
|
@ -47,13 +48,13 @@ public class ZulipStream extends ModerationThread {
|
|||
}
|
||||
|
||||
protected ZulipRestExecutor getZulipRestExecutor() {
|
||||
ZulipAuth zulipAuth = new ZulipAuth(SecretManager.instance.get().getUser().getUsername());
|
||||
ZulipAuth zulipAuth = new ZulipAuth(SecretManagerProvider.instance.get().getUser().getUsername());
|
||||
return new ZulipRestExecutor(zulipAuth.getEmail(), zulipAuth.getAPIKey(), zulipAuth.getSite());
|
||||
}
|
||||
|
||||
public ZulipRestExecutor getGCatZulipRestExecutor() throws Exception {
|
||||
if(gCatZulipRestExecutor==null) {
|
||||
SecretManager secretManager = SecretManager.instance.get();
|
||||
SecretManager secretManager = SecretManagerProvider.instance.get();
|
||||
Secret secret = Constants.getCatalogueSecret();
|
||||
secretManager.startSession(secret);
|
||||
gCatZulipRestExecutor = getZulipRestExecutor();
|
||||
|
|
|
@ -2,7 +2,7 @@ package org.gcube.gcat.persistence.ckan;
|
|||
|
||||
import org.gcube.com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
import org.gcube.com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import org.gcube.common.authorization.utils.manager.SecretManager;
|
||||
import org.gcube.common.authorization.utils.manager.SecretManagerProvider;
|
||||
import org.gcube.common.scope.impl.ScopeBean;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -68,7 +68,7 @@ public class CKANOrganization extends CKAN {
|
|||
}
|
||||
|
||||
public static String getCKANOrganizationName() {
|
||||
String context = SecretManager.instance.get().getContext();
|
||||
String context = SecretManagerProvider.instance.get().getContext();
|
||||
return getCKANOrganizationName(context);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ import org.apache.tika.mime.MimeType;
|
|||
import org.apache.tika.mime.MimeTypes;
|
||||
import org.gcube.com.fasterxml.jackson.databind.JsonNode;
|
||||
import org.gcube.com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import org.gcube.common.authorization.utils.manager.SecretManager;
|
||||
import org.gcube.common.authorization.utils.manager.SecretManagerProvider;
|
||||
import org.gcube.common.gxhttp.request.GXHTTPStringRequest;
|
||||
import org.gcube.gcat.utils.Constants;
|
||||
import org.gcube.gcat.utils.HTTPCall;
|
||||
|
@ -69,7 +69,7 @@ public class CKANResource extends CKAN {
|
|||
public static final String URI_RESOLVER_STORAGE_HUB_PATH = "/shub/";
|
||||
|
||||
static {
|
||||
String context = SecretManager.instance.get().getContext();
|
||||
String context = SecretManagerProvider.instance.get().getContext();
|
||||
if(context.startsWith("/gcube")) {
|
||||
URI_RESOLVER_STORAGE_HUB_HOST = URI_RESOLVER_STORAGE_HUB_HOST_DEV;
|
||||
} else if(context.startsWith("/pred4s")){
|
||||
|
|
|
@ -7,7 +7,7 @@ import javax.ws.rs.WebApplicationException;
|
|||
import javax.ws.rs.core.Response.Status;
|
||||
|
||||
import org.gcube.com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import org.gcube.common.authorization.utils.manager.SecretManager;
|
||||
import org.gcube.common.authorization.utils.manager.SecretManagerProvider;
|
||||
import org.gcube.common.authorization.utils.user.User;
|
||||
import org.gcube.gcat.api.moderation.Moderated;
|
||||
import org.gcube.gcat.api.roles.Role;
|
||||
|
@ -82,7 +82,7 @@ public class CKANUser extends CKAN {
|
|||
* @return true if the display name and the full name has been updated in objectNode
|
||||
*/
|
||||
private boolean checkAndSetJobTitle(ObjectNode objectNode) {
|
||||
String jobTitle = SecretManager.instance.get().getUser().getAbout();
|
||||
String jobTitle = SecretManagerProvider.instance.get().getUser().getAbout();
|
||||
|
||||
String ckanJobTitle = "";
|
||||
if(objectNode.has(ABOUT)) {
|
||||
|
@ -121,7 +121,7 @@ public class CKANUser extends CKAN {
|
|||
* @return true if the display name and the full name has been updated
|
||||
*/
|
||||
private boolean checkAndSetEmail(ObjectNode objectNode) {
|
||||
String portalEmail = SecretManager.instance.get().getUser().getEmail();
|
||||
String portalEmail = SecretManagerProvider.instance.get().getUser().getEmail();
|
||||
|
||||
String ckanEmail = "";
|
||||
if(objectNode.has(EMAIL)) {
|
||||
|
@ -194,7 +194,7 @@ public class CKANUser extends CKAN {
|
|||
}
|
||||
|
||||
public static String getCKANUsername() {
|
||||
String username = SecretManager.instance.get().getUser().getUsername();
|
||||
String username = SecretManagerProvider.instance.get().getUser().getUsername();
|
||||
return getCKANUsername(username);
|
||||
}
|
||||
|
||||
|
@ -215,7 +215,7 @@ public class CKANUser extends CKAN {
|
|||
public Role getRole() {
|
||||
if(role == null) {
|
||||
role = Role.MEMBER;
|
||||
Collection<String> roles = SecretManager.instance.get().getUser().getRoles();
|
||||
Collection<String> roles = SecretManagerProvider.instance.get().getUser().getRoles();
|
||||
for(String portalRole : roles) {
|
||||
Role gotRole = Role.getRoleFromPortalRole(portalRole);
|
||||
if(gotRole != null && gotRole.ordinal() > role.ordinal()) {
|
||||
|
@ -252,23 +252,23 @@ public class CKANUser extends CKAN {
|
|||
|
||||
public boolean isCatalogueModerator() {
|
||||
if(catalogueModerator == null) {
|
||||
catalogueModerator = SecretManager.instance.get().getUser().getRoles().contains(Moderated.CATALOGUE_MODERATOR);
|
||||
catalogueModerator = SecretManagerProvider.instance.get().getUser().getRoles().contains(Moderated.CATALOGUE_MODERATOR);
|
||||
}
|
||||
return catalogueModerator;
|
||||
}
|
||||
|
||||
public String getSurnameName(){
|
||||
User user = SecretManager.instance.get().getUser();
|
||||
User user = SecretManagerProvider.instance.get().getUser();
|
||||
return String.format("%s %s", user.getFamilyName(), user.getGivenName()).trim();
|
||||
}
|
||||
|
||||
public String getNameSurname() {
|
||||
User user = SecretManager.instance.get().getUser();
|
||||
User user = SecretManagerProvider.instance.get().getUser();
|
||||
return String.format("%s %s", user.getGivenName(), user.getFamilyName()).trim();
|
||||
}
|
||||
|
||||
public String getEMail() {
|
||||
return SecretManager.instance.get().getUser().getEmail();
|
||||
return SecretManagerProvider.instance.get().getUser().getEmail();
|
||||
}
|
||||
|
||||
}
|
|
@ -13,6 +13,7 @@ import javax.cache.expiry.Duration;
|
|||
import javax.cache.spi.CachingProvider;
|
||||
|
||||
import org.gcube.common.authorization.utils.manager.SecretManager;
|
||||
import org.gcube.common.authorization.utils.manager.SecretManagerProvider;
|
||||
|
||||
public abstract class CKANUserCache {
|
||||
|
||||
|
@ -37,7 +38,7 @@ public abstract class CKANUserCache {
|
|||
}
|
||||
|
||||
public static CKANUser getCurrrentCKANUser() {
|
||||
SecretManager secretManager = SecretManager.instance.get();
|
||||
SecretManager secretManager = SecretManagerProvider.instance.get();
|
||||
String context = secretManager.getContext();
|
||||
Cache<String,CKANUser> userCache = userCachePerContext.get(context);
|
||||
if(userCache == null) {
|
||||
|
|
|
@ -23,7 +23,7 @@ import javax.xml.ws.WebServiceException;
|
|||
|
||||
import org.gcube.com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.gcube.com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import org.gcube.common.authorization.utils.manager.SecretManager;
|
||||
import org.gcube.common.authorization.utils.manager.SecretManagerProvider;
|
||||
import org.gcube.gcat.annotation.PATCH;
|
||||
import org.gcube.gcat.annotation.PURGE;
|
||||
import org.gcube.gcat.api.GCatConstants;
|
||||
|
@ -50,7 +50,7 @@ public class Configuration extends BaseREST implements org.gcube.gcat.api.interf
|
|||
throw new BadRequestException("Please provide a valid context as path parameter");
|
||||
}
|
||||
|
||||
String c = SecretManager.instance.get().getContext();
|
||||
String c = SecretManagerProvider.instance.get().getContext();
|
||||
if(context.compareTo(Configuration.CURRENT_CONTEXT_PATH_PARAMETER)==0) {
|
||||
return c;
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ public class Configuration extends BaseREST implements org.gcube.gcat.api.interf
|
|||
|
||||
if(node.has(ServiceCatalogueConfiguration.CONTEXT_KEY)) {
|
||||
String context = node.get(ServiceCatalogueConfiguration.CONTEXT_KEY).asText();
|
||||
String c = SecretManager.instance.get().getContext();
|
||||
String c = SecretManagerProvider.instance.get().getContext();
|
||||
if(c.compareTo(context)!=0) {
|
||||
throw new BadRequestException("Context provided in the configuration (i.e. " + catalogueConfiguration.getContext() + ") does not match with token request context (i.e. " + c + ")");
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import org.gcube.com.fasterxml.jackson.databind.JsonNode;
|
|||
import org.gcube.com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.gcube.com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
import org.gcube.com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import org.gcube.common.authorization.utils.manager.SecretManager;
|
||||
import org.gcube.common.authorization.utils.manager.SecretManagerProvider;
|
||||
import org.gcube.common.authorization.utils.socialservice.SocialService;
|
||||
import org.gcube.common.gxhttp.request.GXHTTPStringRequest;
|
||||
import org.gcube.gcat.api.configuration.CatalogueConfiguration;
|
||||
|
@ -121,7 +121,7 @@ public class SocialPost extends Thread {
|
|||
CatalogueConfiguration instance = CatalogueConfigurationFactory.getInstance();
|
||||
|
||||
if(!instance.isSocialPostEnabled()) {
|
||||
logger.info("Social Post are disabled in the context {}", SecretManager.instance.get().getContext());
|
||||
logger.info("Social Post are disabled in the context {}", SecretManagerProvider.instance.get().getContext());
|
||||
return;
|
||||
}
|
||||
logger.info("Going to send Social Post about the Item {} available at {}", itemID, itemURL);
|
||||
|
|
|
@ -5,7 +5,7 @@ import java.util.Properties;
|
|||
|
||||
import javax.ws.rs.InternalServerErrorException;
|
||||
|
||||
import org.gcube.common.authorization.utils.manager.SecretManager;
|
||||
import org.gcube.common.authorization.utils.manager.SecretManagerProvider;
|
||||
import org.gcube.common.authorization.utils.secret.JWTSecret;
|
||||
import org.gcube.common.authorization.utils.secret.Secret;
|
||||
import org.gcube.common.keycloak.KeycloakClientFactory;
|
||||
|
@ -34,12 +34,12 @@ public class Constants {
|
|||
return clientSecret;
|
||||
} catch(Exception e) {
|
||||
throw new InternalServerErrorException(
|
||||
"Unable to retrieve Application Token for context " + SecretManager.instance.get().getContext(), e);
|
||||
"Unable to retrieve Application Token for context " + SecretManagerProvider.instance.get().getContext(), e);
|
||||
}
|
||||
}
|
||||
|
||||
private static TokenResponse getJWTAccessToken() throws Exception {
|
||||
String contextToAuthorise = SecretManager.instance.get().getContext();
|
||||
String contextToAuthorise = SecretManagerProvider.instance.get().getContext();
|
||||
TokenResponse tr = KeycloakClientFactory.newInstance().queryUMAToken(CLIENT_ID, getClientSecret(contextToAuthorise), contextToAuthorise, null);
|
||||
return tr;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import java.util.Map;
|
|||
|
||||
import javax.ws.rs.WebApplicationException;
|
||||
|
||||
import org.gcube.common.authorization.utils.manager.SecretManager;
|
||||
import org.gcube.common.authorization.utils.manager.SecretManagerProvider;
|
||||
import org.gcube.portlets.user.uriresolvermanager.UriResolverManager;
|
||||
|
||||
public abstract class URIResolver {
|
||||
|
@ -19,7 +19,7 @@ public abstract class URIResolver {
|
|||
|
||||
public static String getCatalogueItemURL(String name) {
|
||||
try {
|
||||
String context = SecretManager.instance.get().getContext();
|
||||
String context = SecretManagerProvider.instance.get().getContext();
|
||||
UriResolverManager uriResolverManager = new UriResolverManager("CTLG");
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put(CATALOGUE_CONTEXT, context);
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.net.URL;
|
|||
import java.util.Map;
|
||||
|
||||
import org.gcube.common.authorization.utils.manager.SecretManager;
|
||||
import org.gcube.common.authorization.utils.manager.SecretManagerProvider;
|
||||
import org.gcube.common.authorization.utils.secret.Secret;
|
||||
import org.gcube.common.gxhttp.request.GXHTTPStringRequest;
|
||||
import org.gcube.common.storagehub.client.dsl.FileContainer;
|
||||
|
@ -44,7 +45,7 @@ public class CatalogueStorageHubManagement {
|
|||
}
|
||||
|
||||
public URL ensureResourcePersistence(URL persistedURL, String itemID, String resourceID) throws Exception {
|
||||
SecretManager secretManager = SecretManager.instance.get();
|
||||
SecretManager secretManager = SecretManagerProvider.instance.get();
|
||||
Secret secret = Constants.getCatalogueSecret();
|
||||
try {
|
||||
secretManager.startSession(secret);
|
||||
|
@ -70,7 +71,7 @@ public class CatalogueStorageHubManagement {
|
|||
}
|
||||
|
||||
public void deleteResourcePersistence(String itemID, String resourceID, String mimeType) throws Exception {
|
||||
SecretManager secretManager = SecretManager.instance.get();
|
||||
SecretManager secretManager = SecretManagerProvider.instance.get();
|
||||
Secret secret = Constants.getCatalogueSecret();
|
||||
try {
|
||||
secretManager.startSession(secret);
|
||||
|
@ -100,7 +101,7 @@ public class CatalogueStorageHubManagement {
|
|||
}
|
||||
|
||||
public void renameFile(String resourceID, String revisionID) throws Exception {
|
||||
SecretManager secretManager = SecretManager.instance.get();
|
||||
SecretManager secretManager = SecretManagerProvider.instance.get();
|
||||
Secret secret = Constants.getCatalogueSecret();
|
||||
try {
|
||||
secretManager.startSession(secret);
|
||||
|
@ -114,7 +115,7 @@ public class CatalogueStorageHubManagement {
|
|||
}
|
||||
|
||||
public void addRevisionID(String resourceID, String revisionID) throws Exception {
|
||||
SecretManager secretManager = SecretManager.instance.get();
|
||||
SecretManager secretManager = SecretManagerProvider.instance.get();
|
||||
Secret secret = Constants.getCatalogueSecret();
|
||||
try {
|
||||
secretManager.startSession(secret);
|
||||
|
@ -125,7 +126,7 @@ public class CatalogueStorageHubManagement {
|
|||
}
|
||||
|
||||
public FileContainer retrievePersistedFile(String id, String mimeType) throws Exception {
|
||||
SecretManager secretManager = SecretManager.instance.get();
|
||||
SecretManager secretManager = SecretManagerProvider.instance.get();
|
||||
Secret secret = Constants.getCatalogueSecret();
|
||||
try {
|
||||
secretManager.startSession(secret);
|
||||
|
|
|
@ -8,6 +8,7 @@ import java.io.InputStream;
|
|||
import java.util.Properties;
|
||||
|
||||
import org.gcube.common.authorization.utils.manager.SecretManager;
|
||||
import org.gcube.common.authorization.utils.manager.SecretManagerProvider;
|
||||
import org.gcube.common.authorization.utils.secret.Secret;
|
||||
import org.gcube.common.authorization.utils.secret.SecretUtility;
|
||||
import org.junit.AfterClass;
|
||||
|
@ -48,8 +49,10 @@ public class ContextTest {
|
|||
}
|
||||
|
||||
public static void set(Secret secret) throws Exception {
|
||||
SecretManager.instance.get().reset();
|
||||
secret.set();
|
||||
SecretManagerProvider.instance.reset();
|
||||
SecretManager secretManager = SecretManagerProvider.instance.get();
|
||||
secretManager.addSecret(secret);
|
||||
secretManager.set();
|
||||
}
|
||||
|
||||
public static void setContext(String token) throws Exception {
|
||||
|
@ -79,7 +82,7 @@ public class ContextTest {
|
|||
|
||||
@AfterClass
|
||||
public static void afterClass() throws Exception {
|
||||
SecretManager.instance.get().reset();
|
||||
SecretManagerProvider.instance.reset();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import java.io.InputStreamReader;
|
|||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.gcube.common.authorization.utils.manager.SecretManager;
|
||||
import org.gcube.common.authorization.utils.manager.SecretManagerProvider;
|
||||
import org.gcube.gcat.ContextTest;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
@ -23,7 +23,7 @@ public class GCoreISConfigurationProxyTest extends ContextTest {
|
|||
// @Test
|
||||
public void testGetSupportedOrganizationsFromIS() throws Exception {
|
||||
ContextTest.setContextByName("/gcube/devNext/NextNext");
|
||||
String context = SecretManager.instance.get().getContext();
|
||||
String context = SecretManagerProvider.instance.get().getContext();
|
||||
GCoreISConfigurationProxy gCoreISConfigurationProxy = new GCoreISConfigurationProxy(context);
|
||||
@SuppressWarnings("deprecation")
|
||||
Set<String> organizations = gCoreISConfigurationProxy.getSupportedOrganizationsFromGenericResource();
|
||||
|
@ -33,7 +33,7 @@ public class GCoreISConfigurationProxyTest extends ContextTest {
|
|||
@Test
|
||||
public void testCatalogueConfiguration() throws Exception {
|
||||
ContextTest.setContextByName("/gcube/devsec/devVRE");
|
||||
String context = SecretManager.instance.get().getContext();
|
||||
String context = SecretManagerProvider.instance.get().getContext();
|
||||
GCoreISConfigurationProxy gCoreISConfigurationProxy = new GCoreISConfigurationProxy(context);
|
||||
ServiceCatalogueConfiguration catalogueConfiguration = gCoreISConfigurationProxy.getCatalogueConfigurationFromIS();
|
||||
String json = catalogueConfiguration.toJsonString();
|
||||
|
@ -54,7 +54,7 @@ public class GCoreISConfigurationProxyTest extends ContextTest {
|
|||
// @Test
|
||||
public void updateConfigurationToNewVersion() throws Exception {
|
||||
ContextTest.setContextByName("/gcube/devsec/devVRE");
|
||||
String context = SecretManager.instance.get().getContext();
|
||||
String context = SecretManagerProvider.instance.get().getContext();
|
||||
GCoreISConfigurationProxy gCoreISConfigurationProxy = new GCoreISConfigurationProxy(context);
|
||||
@SuppressWarnings("deprecation")
|
||||
ServiceCatalogueConfiguration catalogueConfiguration = gCoreISConfigurationProxy.getOLDCatalogueConfigurationFromIS();
|
||||
|
@ -70,7 +70,7 @@ public class GCoreISConfigurationProxyTest extends ContextTest {
|
|||
//@Test
|
||||
public void createConfiguration() throws Exception {
|
||||
ContextTest.setContextByName("/gcube/devsec/devVRE");
|
||||
String context = SecretManager.instance.get().getContext();
|
||||
String context = SecretManagerProvider.instance.get().getContext();
|
||||
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(DEVVRE_CONFIG_JSON);
|
||||
String json = new BufferedReader(new InputStreamReader(inputStream)).lines().collect(Collectors.joining("\n"));
|
||||
ServiceCatalogueConfiguration catalogueConfiguration = ServiceCatalogueConfiguration.getServiceCatalogueConfiguration(json);
|
||||
|
|
|
@ -3,7 +3,7 @@ package org.gcube.gcat.persistence.ckan;
|
|||
import org.gcube.com.fasterxml.jackson.databind.JsonNode;
|
||||
import org.gcube.com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.gcube.com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
import org.gcube.common.authorization.utils.manager.SecretManager;
|
||||
import org.gcube.common.authorization.utils.manager.SecretManagerProvider;
|
||||
import org.gcube.common.scope.impl.ScopeBean;
|
||||
import org.gcube.gcat.ContextTest;
|
||||
import org.gcube.gcat.api.configuration.CatalogueConfiguration;
|
||||
|
@ -60,7 +60,7 @@ public class CKANOrganizationTest extends ContextTest {
|
|||
@Test
|
||||
public void createOrganization() throws Exception {
|
||||
ContextTest.setContextByName("/gcube/devNext/NextNext");
|
||||
String context = SecretManager.instance.get().getContext();
|
||||
String context = SecretManagerProvider.instance.get().getContext();
|
||||
ScopeBean scopeBean = new ScopeBean(context);
|
||||
CKANOrganization ckanOrganization = new CKANOrganization();
|
||||
ckanOrganization.setApiKey(CKANUtility.getSysAdminAPI());
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.gcube.com.fasterxml.jackson.databind.ObjectMapper;
|
|||
import org.gcube.com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
import org.gcube.com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import org.gcube.common.authorization.library.provider.UserInfo;
|
||||
import org.gcube.common.authorization.utils.manager.SecretManager;
|
||||
import org.gcube.common.authorization.utils.manager.SecretManagerProvider;
|
||||
import org.gcube.common.scope.impl.ScopeBean;
|
||||
import org.gcube.gcat.ContextTest;
|
||||
import org.gcube.gcat.api.GCatConstants;
|
||||
|
@ -54,7 +54,7 @@ public class CKANPackageTest extends ContextTest {
|
|||
public void count() throws Exception {
|
||||
CKANPackage ckanPackage = new CKANPackage();
|
||||
int count = ckanPackage.count();
|
||||
logger.debug("Number of items in {} is {}", SecretManager.instance.get().getContext(), count);
|
||||
logger.debug("Number of items in {} is {}", SecretManagerProvider.instance.get().getContext(), count);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -311,7 +311,7 @@ public class CKANPackageTest extends ContextTest {
|
|||
}
|
||||
|
||||
protected CKANPackage createPackage(ObjectMapper mapper, Boolean socialPost) throws Exception {
|
||||
String currentContext = SecretManager.instance.get().getContext();
|
||||
String currentContext = SecretManagerProvider.instance.get().getContext();
|
||||
ScopeBean scopeBean = new ScopeBean(currentContext);
|
||||
String organization = CatalogueConfiguration.getOrganizationName(scopeBean);
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.gcube.gcat.utils;
|
||||
|
||||
import org.gcube.common.authorization.utils.manager.SecretManager;
|
||||
import org.gcube.common.authorization.utils.manager.SecretManagerProvider;
|
||||
import org.gcube.common.encryption.encrypter.StringEncrypter;
|
||||
import org.gcube.gcat.ContextTest;
|
||||
import org.junit.Test;
|
||||
|
@ -13,7 +13,7 @@ public class ConstantsTest extends ContextTest {
|
|||
|
||||
@Test
|
||||
public void testGetApplicationToken() throws Exception {
|
||||
logger.debug("Application token for Context {} is {}", SecretManager.instance.get().getContext(),
|
||||
logger.debug("Application token for Context {} is {}", SecretManagerProvider.instance.get().getContext(),
|
||||
Constants.getCatalogueSecret().getToken());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue