Compare commits

..

2 Commits

Author SHA1 Message Date
Alfredo Oliviero c56f8ec9c2 v1.3.0 2024-04-17 11:08:28 +02:00
Alfredo Oliviero 910397f3d1 removed logs 2024-04-17 11:08:18 +02:00
5 changed files with 20 additions and 27 deletions

View File

@ -1,10 +1,9 @@
# Changelog # Changelog
## [v1.3.0-SNAPSHOT] - 20240-03-22 ## [v1.3.0] = 2024-04-10
Token exchange (#27099)
Client-exchange configuration for a dedicated client (#27204) Client-exchange configuration for a dedicated client (#27204)
## [v1.2.0] - 2023-03-20 ## [v1.2.0] - 2024-03-20
- Decode Button - Decode Button
- Updatet layout - Updatet layout

View File

@ -1,3 +1,3 @@
VERSION=1.3.0-SNAPSHOT VERSION=1.3.0
mvn package mvn package
scp target/rpt-token-portlet-$VERSION.war life@10.1.30.156:/home/life/Portal-Bundle/deploy/rpt-token-portlet.war scp target/rpt-token-portlet-$VERSION.war life@10.1.30.156:/home/life/Portal-Bundle/deploy/rpt-token-portlet.war

View File

@ -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.1.0</version> <version>1.2.0</version>
<relativePath /> <relativePath />
</parent> </parent>
<groupId>org.gcube.portlets.admin</groupId> <groupId>org.gcube.portlets.admin</groupId>
<artifactId>rpt-token-portlet</artifactId> <artifactId>rpt-token-portlet</artifactId>
<packaging>war</packaging> <packaging>war</packaging>
<name>RPT UMA Token Portlet</name> <name>RPT UMA Token Portlet</name>
<version>1.3.0-SNAPSHOT</version> <version>1.3.0</version>
<description> <description>
Requesting Party Token Portlet Requesting Party Token Portlet
</description> </description>

View File

@ -44,7 +44,12 @@ public class OpenIdConnectRESTHelperExtended extends OpenIdConnectRESTHelper {
String client_secret, String client_secret,
List<String> permissions) throws OpenIdConnectRESTHelperException { List<String> permissions) throws OpenIdConnectRESTHelperException {
logger.info("Queried exchangeToken for context " + audience); // logger.info("Queried exchangeToken for context " + audience);
// logger.info("token url " + tokenUrl);
// logger.info("exchangedToken credentials " + client_id + " " + client_secret) ;
Map<String, List<String>> params = new HashMap<>(); Map<String, List<String>> params = new HashMap<>();
Map<String, String> extraHeaders = new HashMap<>(); Map<String, String> extraHeaders = new HashMap<>();

View File

@ -63,14 +63,14 @@ public class RPTTokenReader extends MVCPortlet {
if (g.getGroupName().equals(PortalContext.getConfiguration().getInfrastructureName())) { if (g.getGroupName().equals(PortalContext.getConfiguration().getInfrastructureName())) {
String context = gm.getInfrastructureScope(g.getGroupId()); String context = gm.getInfrastructureScope(g.getGroupId());
userContexts.add(context); userContexts.add(context);
if (context.split("/").length == 4){ if (context.split("/").length == 4) {
vreContexts.add(context); vreContexts.add(context);
} }
} }
if (g.getParentGroupId() > 0) { if (g.getParentGroupId() > 0) {
String context = gm.getInfrastructureScope(g.getGroupId()); String context = gm.getInfrastructureScope(g.getGroupId());
userContexts.add(context); userContexts.add(context);
if (context.split("/").length == 4){ if (context.split("/").length == 4) {
vreContexts.add(context); vreContexts.add(context);
} }
} }
@ -97,7 +97,6 @@ public class RPTTokenReader extends MVCPortlet {
GroupManager gm = new LiferayGroupManager(); GroupManager gm = new LiferayGroupManager();
resourceResponse.setContentType("application/json"); resourceResponse.setContentType("application/json");
JSONObject jsonObject = JSONFactoryUtil.createJSONObject(); JSONObject jsonObject = JSONFactoryUtil.createJSONObject();
@ -119,32 +118,22 @@ public class RPTTokenReader extends MVCPortlet {
JWTToken authToken = jwtCacheProxy.getOIDCToken(theUser, sessionId); JWTToken authToken = jwtCacheProxy.getOIDCToken(theUser, sessionId);
// umaToken = OpenIdConnectRESTHelper.queryUMAToken(configuration.getTokenURL(), // umaToken = OpenIdConnectRESTHelper.queryUMAToken(configuration.getTokenURL(),
// authToken.getAccessTokenAsBearer(), urlEncodedContext, null); // authToken.getAccessTokenAsBearer(), urlEncodedContext, null);
// URL auth_url = configuration.getTokenURL();
// log.info("auth_url " + auth_url);
// log.info("authToken '" + authToken.getAccessTokenString() + "'");
// log.info("umaToken " + umaToken.getAccessTokenString());
// log.info("context " + context);
// log.info("encoded_context " + urlEncodedContext);
// log.info("client_id " + configuration.getPortalClientId());
// log.info("client_secret " + configuration.getPortalClientSecret());
Long companyId = PortalUtil.getCompanyId(httpReq); Long companyId = PortalUtil.getCompanyId(httpReq);
String exchangeClientId = PrefsPropsUtil.getString(companyId, "d4science.oidc-token-exchange-dedicated-client-id"); String exchangeClientId = PrefsPropsUtil.getString(companyId,
String exchangeClientSecret = PrefsPropsUtil.getString(companyId, "d4science.oidc-token-exchange-dedicated-client-secret"); "d4science.oidc-token-exchange-dedicated-client-id");
String exchangeClientSecret = PrefsPropsUtil.getString(companyId,
"d4science.oidc-token-exchange-dedicated-client-secret");
exchangedToken = OpenIdConnectRESTHelperExtended.ExtendedQueryExchangeToken( exchangedToken = OpenIdConnectRESTHelperExtended.ExtendedQueryExchangeToken(
configuration.getTokenURL(), configuration.getTokenURL(),
authToken.getAccessTokenString(), authToken.getAccessTokenString(),
urlEncodedContext, urlEncodedContext,
exchangeClientId, exchangeClientId,
exchangeClientSecret, exchangeClientSecret,
null null);
);
// log.info("exchangedToken " + exchangedToken.getAccessTokenString());
// log.debug("Got a new UMA token " + exchangedToken.getTokenEssentials()); // log.debug("Got a new UMA token " + exchangedToken.getTokenEssentials());
} catch (OpenIdConnectRESTHelperException e) { } catch (OpenIdConnectRESTHelperException e) {