updated method that reads the invitation key from social service
This commit is contained in:
parent
742e5ca99c
commit
7cf9dd8700
|
@ -4,6 +4,8 @@
|
||||||
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-SNAPSHOT] - 2024-04-22
|
||||||
|
|
||||||
## [v2.0.1] - 2022-06-16
|
## [v2.0.1] - 2022-06-16
|
||||||
|
|
||||||
- Release for HL portal removal
|
- Release for HL portal removal
|
||||||
|
|
19
pom.xml
19
pom.xml
|
@ -12,7 +12,7 @@
|
||||||
<artifactId>accept-invite-portlet</artifactId>
|
<artifactId>accept-invite-portlet</artifactId>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
<name>accept-invite-portlet Portlet</name>
|
<name>accept-invite-portlet Portlet</name>
|
||||||
<version>2.0.1</version>
|
<version>2.1.0.SNAPSHOT</version>
|
||||||
<description>
|
<description>
|
||||||
accept-invite-portlet manage the sent invitations
|
accept-invite-portlet manage the sent invitations
|
||||||
</description>
|
</description>
|
||||||
|
@ -34,7 +34,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.4</version>
|
<version>3.7.0</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
@ -58,8 +58,21 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.portal</groupId>
|
<groupId>org.gcube.portal</groupId>
|
||||||
<artifactId>social-networking-library</artifactId>
|
<artifactId>social-library-stubs</artifactId>
|
||||||
|
<version>[1.0.0-SNAPSHOT, 2.0.0)</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.social-networking</groupId>
|
||||||
|
<artifactId>social-service-client</artifactId>
|
||||||
|
<version>[2.0.0-SNAPSHOT, 3.0.0)</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.gcube.portal</groupId>
|
||||||
|
<artifactId>social-networking-library</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.dvos</groupId>
|
<groupId>org.gcube.dvos</groupId>
|
||||||
|
|
|
@ -13,6 +13,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.gcube.portlets.user.acceptinvite;
|
package org.gcube.portlets.user.acceptinvite;
|
||||||
|
import static org.gcube.common.authorization.client.Constants.authorizationService;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
@ -24,6 +28,8 @@ import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
import org.apache.commons.codec.binary.Base64;
|
import org.apache.commons.codec.binary.Base64;
|
||||||
|
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||||
|
import org.gcube.common.authorization.library.provider.UserInfo;
|
||||||
import org.gcube.common.portal.PortalContext;
|
import org.gcube.common.portal.PortalContext;
|
||||||
import org.gcube.portal.databook.server.DBCassandraAstyanaxImpl;
|
import org.gcube.portal.databook.server.DBCassandraAstyanaxImpl;
|
||||||
import org.gcube.portal.databook.server.DatabookStore;
|
import org.gcube.portal.databook.server.DatabookStore;
|
||||||
|
@ -75,7 +81,7 @@ public class PortletViewController {
|
||||||
private static String MODEL_ATTR = "theModel";
|
private static String MODEL_ATTR = "theModel";
|
||||||
|
|
||||||
private static DatabookStore store;
|
private static DatabookStore store;
|
||||||
|
private final static String DEFAULT_ROLE = "OrganizationMember";
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return the unique instance of the store
|
* @return the unique instance of the store
|
||||||
|
@ -115,6 +121,8 @@ public class PortletViewController {
|
||||||
Invite invite = null;
|
Invite invite = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
String token = generateAuthorizationToken();
|
||||||
|
SecurityTokenProvider.instance.set(token);
|
||||||
invite = getStore().readInvite(inviteId);
|
invite = getStore().readInvite(inviteId);
|
||||||
} catch (InviteIDNotFoundException | InviteStatusNotFoundException e) {
|
} catch (InviteIDNotFoundException | InviteStatusNotFoundException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -146,7 +154,21 @@ public class PortletViewController {
|
||||||
return PAGE_INVITE_PROCESS;
|
return PAGE_INVITE_PROCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String generateAuthorizationToken() {
|
||||||
|
PortalContext pContext = PortalContext.getConfiguration();
|
||||||
|
String context = "/" + pContext.getInfrastructureName();
|
||||||
|
String username = "roberto.cirillo";
|
||||||
|
List<String> userRoles = new ArrayList<>();
|
||||||
|
userRoles.add(DEFAULT_ROLE);
|
||||||
|
String token;
|
||||||
|
try {
|
||||||
|
token = authorizationService().generateUserToken(new UserInfo(username, userRoles), context);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@ResourceMapping(value="createAccount")
|
@ResourceMapping(value="createAccount")
|
||||||
|
|
Loading…
Reference in New Issue