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.
|
||||
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
|
||||
|
||||
- Release for HL portal removal
|
||||
|
|
27
pom.xml
27
pom.xml
|
@ -12,7 +12,7 @@
|
|||
<artifactId>accept-invite-portlet</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<name>accept-invite-portlet Portlet</name>
|
||||
<version>2.0.1</version>
|
||||
<version>2.1.0.SNAPSHOT</version>
|
||||
<description>
|
||||
accept-invite-portlet manage the sent invitations
|
||||
</description>
|
||||
|
@ -34,7 +34,7 @@
|
|||
<dependency>
|
||||
<groupId>org.gcube.distribution</groupId>
|
||||
<artifactId>maven-portal-bom</artifactId>
|
||||
<version>3.6.4</version>
|
||||
<version>3.7.0</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
@ -56,11 +56,24 @@
|
|||
<artifactId>json-simple</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.portal</groupId>
|
||||
<artifactId>social-networking-library</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.portal</groupId>
|
||||
<artifactId>social-library-stubs</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT, 2.0.0)</version>
|
||||
<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>
|
||||
<groupId>org.gcube.dvos</groupId>
|
||||
<artifactId>usermanagement-core</artifactId>
|
||||
|
|
|
@ -13,6 +13,10 @@
|
|||
*/
|
||||
|
||||
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.Pattern;
|
||||
|
||||
|
@ -24,6 +28,8 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpSession;
|
||||
|
||||
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.portal.databook.server.DBCassandraAstyanaxImpl;
|
||||
import org.gcube.portal.databook.server.DatabookStore;
|
||||
|
@ -75,7 +81,7 @@ public class PortletViewController {
|
|||
private static String MODEL_ATTR = "theModel";
|
||||
|
||||
private static DatabookStore store;
|
||||
|
||||
private final static String DEFAULT_ROLE = "OrganizationMember";
|
||||
/**
|
||||
*
|
||||
* @return the unique instance of the store
|
||||
|
@ -115,6 +121,8 @@ public class PortletViewController {
|
|||
Invite invite = null;
|
||||
|
||||
try {
|
||||
String token = generateAuthorizationToken();
|
||||
SecurityTokenProvider.instance.set(token);
|
||||
invite = getStore().readInvite(inviteId);
|
||||
} catch (InviteIDNotFoundException | InviteStatusNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -146,7 +154,21 @@ public class PortletViewController {
|
|||
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")
|
||||
|
|
Loading…
Reference in New Issue