credentials for exchange client from specific parameters in config

This commit is contained in:
Alfredo Oliviero 2024-04-10 15:16:31 +02:00
parent f08edf6985
commit c70331e6a6
2 changed files with 11 additions and 4 deletions

View File

@ -2,8 +2,9 @@
## [v1.3.0-SNAPSHOT] - 20240-03-22
Token exchange (#27099)
Client-exchange configuration for a dedicated client (#27204)
## [v1..0] - 2023-03-20
## [v1.2.0] - 2023-03-20
- Decode Button
- Updatet layout

View File

@ -31,6 +31,7 @@ import com.liferay.portal.kernel.json.JSONFactoryUtil;
import com.liferay.portal.kernel.json.JSONObject;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.util.ParamUtil;
import com.liferay.portal.kernel.util.PrefsPropsUtil;
import com.liferay.portal.model.User;
import com.liferay.portal.util.PortalUtil;
import com.liferay.util.bridges.mvc.MVCPortlet;
@ -122,19 +123,24 @@ public class RPTTokenReader extends MVCPortlet {
// URL auth_url = configuration.getTokenURL();
// log.info("auth_url " + auth_url);
log.info("authToken '" + authToken.getAccessTokenString() + "'");
// 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);
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,
configuration.getPortalClientId(),
configuration.getPortalClientSecret(),
exchangeClientId,
exchangeClientSecret,
null
);