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
## [v1.3.0-SNAPSHOT] - 20240-03-22
Token exchange (#27099)
## [v1.3.0] = 2024-04-10
Client-exchange configuration for a dedicated client (#27204)
## [v1.2.0] - 2023-03-20
## [v1.2.0] - 2024-03-20
- Decode Button
- Updatet layout

View File

@ -1,3 +1,3 @@
VERSION=1.3.0-SNAPSHOT
VERSION=1.3.0
mvn package
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>
<artifactId>maven-parent</artifactId>
<groupId>org.gcube.tools</groupId>
<version>1.1.0</version>
<version>1.2.0</version>
<relativePath />
</parent>
<groupId>org.gcube.portlets.admin</groupId>
<artifactId>rpt-token-portlet</artifactId>
<packaging>war</packaging>
<name>RPT UMA Token Portlet</name>
<version>1.3.0-SNAPSHOT</version>
<version>1.3.0</version>
<description>
Requesting Party Token Portlet
</description>

View File

@ -44,7 +44,12 @@ public class OpenIdConnectRESTHelperExtended extends OpenIdConnectRESTHelper {
String client_secret,
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, String> extraHeaders = new HashMap<>();

View File

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