Browse Source

removed wrong use of token provider

master
Massimiliano Assante 8 months ago
parent
commit
40633c6ed9
  1. 8
      src/main/java/org/gcube/portal/usersaccount/WorkspaceCreateAccountThread.java

8
src/main/java/org/gcube/portal/usersaccount/WorkspaceCreateAccountThread.java

@ -2,6 +2,7 @@ package org.gcube.portal.usersaccount;
import java.util.ArrayList;
import java.util.List;
import org.gcube.common.authorization.library.provider.AccessTokenProvider;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import static org.gcube.common.authorization.client.Constants.authorizationService;
@ -10,7 +11,6 @@ import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.common.storagehub.client.dsl.StorageHubClient;
import org.gcube.common.storagehub.model.exceptions.UserNotAuthorizedException;
import org.gcube.portal.oidc.lr62.OIDCUmaUtil;
import org.gcube.portal.oidc.lr62.UMATokensProvider;
import org.gcube.vomanagement.usermanagement.RoleManager;
import org.gcube.vomanagement.usermanagement.UserManager;
import org.gcube.vomanagement.usermanagement.impl.LiferayGroupManager;
@ -44,7 +44,7 @@ public class WorkspaceCreateAccountThread implements Runnable {
SecurityTokenProvider.instance.set(authorizationToken);
ScopeProvider.instance.set(context);
String previousToken = authorizationToken;
String previousUMAToken = UMATokensProvider.instance.get();
String previousUMAToken = AccessTokenProvider.instance.get();
try {
//get the super user
String infraContext = "/"+PortalContext.getConfiguration().getInfrastructureName();
@ -83,12 +83,12 @@ public class WorkspaceCreateAccountThread implements Runnable {
shc = new StorageHubClient();
shc.createUserAccount(currentUsername);
SecurityTokenProvider.instance.set(previousToken);
UMATokensProvider.instance.set(previousUMAToken);
AccessTokenProvider.instance.set(previousUMAToken);
_log.info("shub.createUserAccount performed for "+username + " with super mega admin (Hopefully)");
}
_log.debug("shub.createUserAccount completed for "+username);
SecurityTokenProvider.instance.set(previousToken);
UMATokensProvider.instance.set(previousUMAToken);
AccessTokenProvider.instance.set(previousUMAToken);
}
}
catch (Exception e) {

Loading…
Cancel
Save