Feature #21505 support new UMATokensProvider class
This commit is contained in:
parent
4fc9e7c8f7
commit
eed8d5e261
5
pom.xml
5
pom.xml
|
@ -12,7 +12,7 @@
|
|||
<groupId>org.gcube.portal.plugins</groupId>
|
||||
<artifactId>VREFolder-hook</artifactId>
|
||||
<name>VREFolder-hook Hook</name>
|
||||
<version>6.8.1</version>
|
||||
<version>6.8.2-SNAPSHOT</version>
|
||||
<packaging>war</packaging>
|
||||
<description>
|
||||
VREFolder-hook handles the user adding/removal from the related Home Library VRE Folder
|
||||
|
@ -35,7 +35,7 @@
|
|||
<dependency>
|
||||
<groupId>org.gcube.distribution</groupId>
|
||||
<artifactId>maven-portal-bom</artifactId>
|
||||
<version>3.6.1</version>
|
||||
<version>3.6.2-SNAPSHOT</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
@ -49,7 +49,6 @@
|
|||
<dependency>
|
||||
<groupId>org.gcube.portal</groupId>
|
||||
<artifactId>oidc-library-portal</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
@ -3,10 +3,10 @@ package org.gcube.portal.plugins;
|
|||
import java.util.List;
|
||||
|
||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||
import org.gcube.common.authorization.library.provider.UmaJWTProvider;
|
||||
import org.gcube.common.storagehub.client.dsl.StorageHubClient;
|
||||
import org.gcube.common.storagehub.client.dsl.Util;
|
||||
import org.gcube.common.storagehub.client.dsl.VREFolderManager;
|
||||
import org.gcube.portal.oidc.lr62.UMATokensProvider;
|
||||
import org.gcube.portal.plugins.util.AuthUtil;
|
||||
import org.gcube.vomanagement.usermanagement.GroupManager;
|
||||
import org.gcube.vomanagement.usermanagement.impl.LiferayGroupManager;
|
||||
|
@ -64,7 +64,7 @@ public class GCubeHookSiteRoleLocalService extends UserGroupRoleLocalServiceWrap
|
|||
|
||||
private void setVREFolderAdministrator(long userId, long groupId, boolean enable) throws Exception {
|
||||
String previousToken = SecurityTokenProvider.instance.get();
|
||||
String previousUMAToken = UmaJWTProvider.instance.get();
|
||||
String previousUMAToken = UMATokensProvider.instance.get();
|
||||
//this put the necessary auth tokens (legacy e UMA) in ThreadLocal
|
||||
AuthUtil.setInfraManagerLegacyAndUMATokenInThreadLocal();
|
||||
String context = gm.getInfrastructureScope(groupId);
|
||||
|
@ -81,7 +81,7 @@ public class GCubeHookSiteRoleLocalService extends UserGroupRoleLocalServiceWrap
|
|||
vreFolderManager.removeAdmin(theUserToPromoteOrDeclass);
|
||||
_log.info("*VREFolder-Hook** add/remove role operation complete");
|
||||
|
||||
UmaJWTProvider.instance.set(previousUMAToken);
|
||||
UMATokensProvider.instance.set(previousUMAToken);
|
||||
SecurityTokenProvider.instance.set(previousToken);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package org.gcube.portal.plugins;
|
||||
|
||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||
import org.gcube.common.authorization.library.provider.UmaJWTProvider;
|
||||
import org.gcube.common.portal.PortalContext;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.common.storagehub.client.plugins.AbstractPlugin;
|
||||
import org.gcube.common.storagehub.client.proxies.GroupManagerClient;
|
||||
import org.gcube.portal.oidc.lr62.UMATokensProvider;
|
||||
import org.gcube.portal.plugins.thread.CheckShareLatexUserThread;
|
||||
import org.gcube.portal.plugins.thread.RemoveUserTokenFromVREThread;
|
||||
import org.gcube.portal.plugins.util.AuthUtil;
|
||||
|
@ -150,7 +150,7 @@ public class GCubeHookUserLocalService extends UserLocalServiceWrapper {
|
|||
*/
|
||||
private boolean setUser2VREFolder(GroupManager gm, UserManager uMan, String username2Add, String context, boolean add) throws Exception {
|
||||
String previousToken = SecurityTokenProvider.instance.get();
|
||||
String previousUMAToken = UmaJWTProvider.instance.get();
|
||||
String previousUMAToken = UMATokensProvider.instance.get();
|
||||
AuthUtil.setInfraManagerLegacyAndUMATokenInThreadLocal();
|
||||
_log.info("\n*VREFolder-Hook** new authorizationService PortalClient UMA-Token In ThreadLocal done ****\n\n");
|
||||
String vreFolderNameForsHub = getVREFolderNameFromContext(context);
|
||||
|
@ -161,7 +161,7 @@ public class GCubeHookUserLocalService extends UserLocalServiceWrapper {
|
|||
client.removeUserFromGroup(username2Add, vreFolderNameForsHub);
|
||||
|
||||
_log.info("*VREFolder-Hook** " + username2Add + " was added or removed succefully from this VRE Folder. Added? (if false was removed)" + add);
|
||||
UmaJWTProvider.instance.set(previousUMAToken);
|
||||
UMATokensProvider.instance.set(previousUMAToken);
|
||||
SecurityTokenProvider.instance.set(previousToken);
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue