Compare commits
No commits in common. "master" and "master" have entirely different histories.
|
@ -0,0 +1,33 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="optional" value="true"/>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="optional" value="true"/>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
<attribute name="test" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="output" path="target/classes"/>
|
||||||
|
</classpath>
|
|
@ -1,174 +1 @@
|
||||||
#
|
/target/
|
||||||
ignore_me
|
|
||||||
tomcat
|
|
||||||
|
|
||||||
target
|
|
||||||
.classpath
|
|
||||||
.visual
|
|
||||||
.project
|
|
||||||
.settings
|
|
||||||
/**/.DS_Store
|
|
||||||
|
|
||||||
# Created by https://www.toptal.com/developers/gitignore/api/java,macos,linux,visualstudiocode,eclipse
|
|
||||||
# Edit at https://www.toptal.com/developers/gitignore?templates=java,macos,linux,visualstudiocode,eclipse
|
|
||||||
|
|
||||||
### Eclipse ###
|
|
||||||
.metadata
|
|
||||||
bin/
|
|
||||||
tmp/
|
|
||||||
*.tmp
|
|
||||||
*.bak
|
|
||||||
*.swp
|
|
||||||
*~.nib
|
|
||||||
local.properties
|
|
||||||
.settings/
|
|
||||||
.loadpath
|
|
||||||
.recommenders
|
|
||||||
|
|
||||||
# External tool builders
|
|
||||||
.externalToolBuilders/
|
|
||||||
|
|
||||||
# Locally stored "Eclipse launch configurations"
|
|
||||||
*.launch
|
|
||||||
|
|
||||||
# PyDev specific (Python IDE for Eclipse)
|
|
||||||
*.pydevproject
|
|
||||||
|
|
||||||
# CDT-specific (C/C++ Development Tooling)
|
|
||||||
.cproject
|
|
||||||
|
|
||||||
# CDT- autotools
|
|
||||||
.autotools
|
|
||||||
|
|
||||||
# Java annotation processor (APT)
|
|
||||||
.factorypath
|
|
||||||
|
|
||||||
# PDT-specific (PHP Development Tools)
|
|
||||||
.buildpath
|
|
||||||
|
|
||||||
# sbteclipse plugin
|
|
||||||
.target
|
|
||||||
|
|
||||||
# Tern plugin
|
|
||||||
.tern-project
|
|
||||||
|
|
||||||
# TeXlipse plugin
|
|
||||||
.texlipse
|
|
||||||
|
|
||||||
# STS (Spring Tool Suite)
|
|
||||||
.springBeans
|
|
||||||
|
|
||||||
# Code Recommenders
|
|
||||||
.recommenders/
|
|
||||||
|
|
||||||
# Annotation Processing
|
|
||||||
.apt_generated/
|
|
||||||
.apt_generated_test/
|
|
||||||
|
|
||||||
# Scala IDE specific (Scala & Java development for Eclipse)
|
|
||||||
.cache-main
|
|
||||||
.scala_dependencies
|
|
||||||
.worksheet
|
|
||||||
|
|
||||||
# Uncomment this line if you wish to ignore the project description file.
|
|
||||||
# Typically, this file would be tracked if it contains build/dependency configurations:
|
|
||||||
#.project
|
|
||||||
|
|
||||||
### Eclipse Patch ###
|
|
||||||
# Spring Boot Tooling
|
|
||||||
.sts4-cache/
|
|
||||||
|
|
||||||
### Java ###
|
|
||||||
# Compiled class file
|
|
||||||
*.class
|
|
||||||
|
|
||||||
# Log file
|
|
||||||
*.log
|
|
||||||
|
|
||||||
# BlueJ files
|
|
||||||
*.ctxt
|
|
||||||
|
|
||||||
# Mobile Tools for Java (J2ME)
|
|
||||||
.mtj.tmp/
|
|
||||||
|
|
||||||
# Package Files #
|
|
||||||
*.jar
|
|
||||||
*.war
|
|
||||||
*.nar
|
|
||||||
*.ear
|
|
||||||
*.zip
|
|
||||||
*.tar.gz
|
|
||||||
*.rar
|
|
||||||
|
|
||||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
|
||||||
hs_err_pid*
|
|
||||||
replay_pid*
|
|
||||||
|
|
||||||
### Linux ###
|
|
||||||
*~
|
|
||||||
|
|
||||||
# temporary files which can be created if a process still has a handle open of a deleted file
|
|
||||||
.fuse_hidden*
|
|
||||||
|
|
||||||
# KDE directory preferences
|
|
||||||
.directory
|
|
||||||
|
|
||||||
# Linux trash folder which might appear on any partition or disk
|
|
||||||
.Trash-*
|
|
||||||
|
|
||||||
# .nfs files are created when an open file is removed but is still being accessed
|
|
||||||
.nfs*
|
|
||||||
|
|
||||||
### macOS ###
|
|
||||||
# General
|
|
||||||
.DS_Store
|
|
||||||
.AppleDouble
|
|
||||||
.LSOverride
|
|
||||||
|
|
||||||
# Icon must end with two \r
|
|
||||||
Icon
|
|
||||||
|
|
||||||
|
|
||||||
# Thumbnails
|
|
||||||
._*
|
|
||||||
|
|
||||||
# Files that might appear in the root of a volume
|
|
||||||
.DocumentRevisions-V100
|
|
||||||
.fseventsd
|
|
||||||
.Spotlight-V100
|
|
||||||
.TemporaryItems
|
|
||||||
.Trashes
|
|
||||||
.VolumeIcon.icns
|
|
||||||
.com.apple.timemachine.donotpresent
|
|
||||||
|
|
||||||
# Directories potentially created on remote AFP share
|
|
||||||
.AppleDB
|
|
||||||
.AppleDesktop
|
|
||||||
Network Trash Folder
|
|
||||||
Temporary Items
|
|
||||||
.apdisk
|
|
||||||
|
|
||||||
### macOS Patch ###
|
|
||||||
# iCloud generated files
|
|
||||||
*.icloud
|
|
||||||
|
|
||||||
### VisualStudioCode ###
|
|
||||||
.vscode/*
|
|
||||||
!.vscode/settings.json
|
|
||||||
!.vscode/tasks.json
|
|
||||||
!.vscode/launch.json
|
|
||||||
!.vscode/extensions.json
|
|
||||||
!.vscode/*.code-snippets
|
|
||||||
|
|
||||||
# Local History for Visual Studio Code
|
|
||||||
.history/
|
|
||||||
|
|
||||||
# Built Visual Studio Code Extensions
|
|
||||||
*.vsix
|
|
||||||
|
|
||||||
### VisualStudioCode Patch ###
|
|
||||||
# Ignore all local history of files
|
|
||||||
.history
|
|
||||||
.ionide
|
|
||||||
|
|
||||||
# End of https://www.toptal.com/developers/gitignore/api/java,macos,linux,visualstudiocode,eclipse
|
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>user-registration-hook</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.wst.validation.validationbuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
||||||
|
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||||
|
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
||||||
|
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
|
||||||
|
<nature>com.liferay.ide.core.liferayNature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="src" path="src/main/webapp"/>
|
||||||
|
<classpathentry kind="src" path="target/m2e-wtp/web-resources"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="hide" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
|
||||||
|
<classpathentry kind="output" path=""/>
|
||||||
|
</classpath>
|
|
@ -0,0 +1,4 @@
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
encoding//src/main/java=UTF-8
|
||||||
|
encoding//src/main/resources=UTF-8
|
||||||
|
encoding/<project>=UTF-8
|
|
@ -0,0 +1,9 @@
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
|
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||||
|
org.eclipse.jdt.core.compiler.release=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.source=1.8
|
|
@ -0,0 +1,4 @@
|
||||||
|
activeProfiles=Liferay-v6.2-CE-(Tomcat-7)-(2)
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
resolveWorkspaceProjects=true
|
||||||
|
version=1
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||||
|
<wb-module deploy-name="user-registration-hook">
|
||||||
|
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||||
|
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||||
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||||
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||||
|
<property name="context-root" value="user-registration-hook"/>
|
||||||
|
<property name="java-output-path" value="/user-registration-hook/target/classes"/>
|
||||||
|
</wb-module>
|
||||||
|
</project-modules>
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<faceted-project>
|
||||||
|
<fixed facet="wst.jsdt.web"/>
|
||||||
|
<installed facet="jst.web" version="2.4"/>
|
||||||
|
<installed facet="liferay.hook" version="6.0"/>
|
||||||
|
<installed facet="wst.jsdt.web" version="1.0"/>
|
||||||
|
<installed facet="java" version="1.8"/>
|
||||||
|
</faceted-project>
|
|
@ -0,0 +1 @@
|
||||||
|
org.eclipse.wst.jsdt.launching.baseBrowserLibrary
|
|
@ -0,0 +1 @@
|
||||||
|
Window
|
|
@ -0,0 +1,2 @@
|
||||||
|
disabled=06target
|
||||||
|
eclipse.preferences.version=1
|
26
CHANGELOG.md
26
CHANGELOG.md
|
@ -1,35 +1,23 @@
|
||||||
|
|
||||||
# Changelog for user-registration-hook
|
# Changelog for user-registration-hook
|
||||||
|
|
||||||
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.1.0]
|
|
||||||
|
|
||||||
- maven-parent 1.2.0
|
|
||||||
- maven-portal-bom 4.0.0
|
|
||||||
- StorageHub downstream components to upgrade in order to work with storagehub 1.5.0 [#27999]
|
|
||||||
|
|
||||||
## [v2.0.4] - 2021-05-25
|
|
||||||
|
|
||||||
- Updated to support new UMATokensProvider class [#21506]
|
|
||||||
|
|
||||||
## [v2.0.3] - 2021-04-12
|
|
||||||
|
|
||||||
- Just removed obsolete Home library deps from pom which were forgotten there in 6.8.0 release
|
|
||||||
|
|
||||||
## [v2.0.2] - 2020-11-13
|
## [v2.0.2] - 2020-11-13
|
||||||
|
|
||||||
- Remove user deletion from ldap upon remove account (offloaded to keycloak) [#20108]
|
Feature #20108, remove user deletion from ldap upon remove account (offloaded to keycloak)
|
||||||
|
|
||||||
## [v2.0.0] - 2017-11-29
|
## [v2.0.0] - 2017-11-29
|
||||||
|
|
||||||
- Provide user workspace drop API [#10483]
|
Feature #10483: Provide user workspace drop API
|
||||||
- Remove user from LDAP upon D4Science user account [#10484]
|
|
||||||
|
Feature #10484: Remove user from LDAP upon D4Science user account
|
||||||
|
|
||||||
## [v1.1.0] - 2016-07-30
|
## [v1.1.0] - 2016-07-30
|
||||||
|
|
||||||
- Update for Liferay 6.2.5
|
Update for Liferay 6.2.5
|
||||||
|
|
||||||
## [v1.0.0] - 2015-06-30
|
## [v1.0.0] - 2015-06-30
|
||||||
|
|
||||||
- First release
|
First release
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# gCube System - User Registration Hook
|
# gCube System - User Registration Hook
|
||||||
|
|
||||||
This component is a Liferay 6.2.6 CE Hook which intercepts new user accounts creation and removal and performs the related Workspace actions
|
This component is a Liferay 6.2.6 CE Hook which intercepts new user accounts creation and removal and performs the related Workspace actions (on sHub and LDAP and Auth)
|
||||||
|
|
||||||
* The source code is present in the src folder.
|
* The source code is present in the src folder.
|
||||||
|
|
||||||
|
|
22
pom.xml
22
pom.xml
|
@ -6,14 +6,14 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>maven-parent</artifactId>
|
<artifactId>maven-parent</artifactId>
|
||||||
<groupId>org.gcube.tools</groupId>
|
<groupId>org.gcube.tools</groupId>
|
||||||
<version>1.2.0</version>
|
<version>1.1.0</version>
|
||||||
<relativePath />
|
<relativePath />
|
||||||
</parent>
|
</parent>
|
||||||
<groupId>org.gcube.portal.liferay</groupId>
|
<groupId>org.gcube.portal.liferay</groupId>
|
||||||
<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.1.0</version>
|
<version>2.0.2</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>4.0.0</version>
|
<version>3.6.0</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
@ -40,6 +40,21 @@
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.common</groupId>
|
||||||
|
<artifactId>home-library</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.common</groupId>
|
||||||
|
<artifactId>home-library-jcr</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.common</groupId>
|
||||||
|
<artifactId>home-library-model</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.core</groupId>
|
<groupId>org.gcube.core</groupId>
|
||||||
<artifactId>common-encryption</artifactId>
|
<artifactId>common-encryption</artifactId>
|
||||||
|
@ -67,6 +82,7 @@
|
||||||
<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>
|
||||||
|
|
|
@ -2,15 +2,11 @@ package org.gcube.portal.usersaccount;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.common.authorization.library.provider.AccessTokenProvider;
|
|
||||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||||
|
|
||||||
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;
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
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.portal.oidc.lr62.OIDCUmaUtil;
|
|
||||||
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;
|
||||||
|
@ -34,9 +30,7 @@ public class WorkspaceCreateAccountThread implements Runnable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
getWS(newUserUserName, "/"+PortalContext.getConfiguration().getInfrastructureName());
|
getWS(newUserUserName, "/"+PortalContext.getConfiguration().getInfrastructureName());
|
||||||
|
|
||||||
}
|
}
|
||||||
public static void getWS(String currentUsername, String context) {
|
public static void getWS(String currentUsername, String context) {
|
||||||
String username = currentUsername;
|
String username = currentUsername;
|
||||||
|
@ -44,7 +38,6 @@ 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 = AccessTokenProvider.instance.get();
|
|
||||||
try {
|
try {
|
||||||
//get the super user
|
//get the super user
|
||||||
String infraContext = "/"+PortalContext.getConfiguration().getInfrastructureName();
|
String infraContext = "/"+PortalContext.getConfiguration().getInfrastructureName();
|
||||||
|
@ -59,7 +52,6 @@ public class WorkspaceCreateAccountThread implements Runnable {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
GCubeUser theAdmin = users.get(0);
|
GCubeUser theAdmin = users.get(0);
|
||||||
_log.debug("Using admin user: " + theAdmin.getUsername() + " to trigger ws creation for new user: " + username);
|
|
||||||
String theAdminToken = PortalContext.getConfiguration().getCurrentUserToken(infraContext, theAdmin.getUsername());
|
String theAdminToken = PortalContext.getConfiguration().getCurrentUserToken(infraContext, theAdmin.getUsername());
|
||||||
List<GCubeRole> theAdminRoles = rm.listRolesByUserAndGroup(theAdmin.getUserId(), groupId);
|
List<GCubeRole> theAdminRoles = rm.listRolesByUserAndGroup(theAdmin.getUserId(), groupId);
|
||||||
List<String> rolesString = new ArrayList<String>();
|
List<String> rolesString = new ArrayList<String>();
|
||||||
|
@ -67,28 +59,10 @@ public class WorkspaceCreateAccountThread implements Runnable {
|
||||||
rolesString.add(gCubeRole.getRoleName());
|
rolesString.add(gCubeRole.getRoleName());
|
||||||
}
|
}
|
||||||
authorizationService().setTokenRoles(theAdminToken, rolesString);
|
authorizationService().setTokenRoles(theAdminToken, rolesString);
|
||||||
_log.debug("setTokenRoles performed on context: " + infraContext + " with token" + theAdminToken + " ("+rolesString+")");
|
|
||||||
SecurityTokenProvider.instance.set(theAdminToken);
|
SecurityTokenProvider.instance.set(theAdminToken);
|
||||||
OIDCUmaUtil.provideConfiguredPortalClientUMATokenInThreadLocal("/" + PortalContext.getConfiguration().getInfrastructureName());
|
|
||||||
_log.info("\n\n\n*** new authorizationService PortalClient UMA-Token In ThreadLocal done ****\n\n");
|
|
||||||
StorageHubClient shc = new StorageHubClient();
|
StorageHubClient shc = new StorageHubClient();
|
||||||
try {
|
shc.createUserAccount(currentUsername);
|
||||||
shc.createUserAccount(currentUsername);
|
|
||||||
_log.info("\n*** shub.createUserAccount done for " + currentUsername);
|
|
||||||
}
|
|
||||||
catch (UserNotAuthorizedException e) {
|
|
||||||
_log.error("shub.createUserAccount failed for "+username + " trying with super mega admin ...");
|
|
||||||
theAdminToken = PortalContext.getConfiguration().getCurrentUserToken(infraContext, "lucio.lelii");
|
|
||||||
SecurityTokenProvider.instance.set(theAdminToken);
|
|
||||||
shc = new StorageHubClient();
|
|
||||||
shc.createUserAccount(currentUsername);
|
|
||||||
SecurityTokenProvider.instance.set(previousToken);
|
|
||||||
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);
|
SecurityTokenProvider.instance.set(previousToken);
|
||||||
AccessTokenProvider.instance.set(previousUMAToken);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
|
|
Loading…
Reference in New Issue