#21506: Updated to support new UMATokensProvider class

This commit is contained in:
Massimiliano Assante 2021-05-25 17:05:11 +02:00
parent c964fea2b4
commit e82dfa44d1
3 changed files with 10 additions and 7 deletions

View File

@ -4,6 +4,10 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v2.0.4-SNAPSHOT] - 2021-05-25
- Feature #21506: Updated to support new UMATokensProvider class
## [v2.0.3] - 2021-04-12 ## [v2.0.3] - 2021-04-12
Just removed obsolete Home library deps from pom which were forgotten there in 6.8.0 release Just removed obsolete Home library deps from pom which were forgotten there in 6.8.0 release

View File

@ -13,7 +13,7 @@
<artifactId>user-registration-hook</artifactId> <artifactId>user-registration-hook</artifactId>
<packaging>war</packaging> <packaging>war</packaging>
<name>user-registration-hook Hook</name> <name>user-registration-hook Hook</name>
<version>2.0.3</version> <version>2.0.4-SNAPSHOT</version>
<scm> <scm>
<connection>scm:git:https://code-repo.d4science.org/gCubeSystem/${project.artifactId}.git</connection> <connection>scm:git:https://code-repo.d4science.org/gCubeSystem/${project.artifactId}.git</connection>
<developerConnection>scm:git:https://code-repo.d4science.org/gCubeSystem/${project.artifactId}.git</developerConnection> <developerConnection>scm:git:https://code-repo.d4science.org/gCubeSystem/${project.artifactId}.git</developerConnection>
@ -32,7 +32,7 @@
<dependency> <dependency>
<groupId>org.gcube.distribution</groupId> <groupId>org.gcube.distribution</groupId>
<artifactId>maven-portal-bom</artifactId> <artifactId>maven-portal-bom</artifactId>
<version>3.6.1</version> <version>3.6.2-SNAPSHOT</version>
<type>pom</type> <type>pom</type>
<scope>import</scope> <scope>import</scope>
</dependency> </dependency>
@ -67,7 +67,6 @@
<dependency> <dependency>
<groupId>org.gcube.portal</groupId> <groupId>org.gcube.portal</groupId>
<artifactId>oidc-library-portal</artifactId> <artifactId>oidc-library-portal</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>

View File

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