Package org.gcube.portlets.admin.service
Class OIDCTokenService
java.lang.Object
org.gcube.portlets.admin.service.OIDCTokenService
Service for handling OIDC token exchange operations
- Author:
- netfarm-m2
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.liferay.portal.kernel.json.JSONObjectexchangeToken(String tokenUrl, String accessToken, String context, String clientId, String clientSecret) Performs token exchange using OAuth2 Token Exchange flowcom.liferay.portal.kernel.json.JSONObjectgetTokenInfo(String token) Extracts basic information from a JWT token without validationbooleanisTokenValid(String token) Validates if a token is still valid (basic validation)
-
Constructor Details
-
OIDCTokenService
public OIDCTokenService()
-
-
Method Details
-
exchangeToken
public com.liferay.portal.kernel.json.JSONObject exchangeToken(String tokenUrl, String accessToken, String context, String clientId, String clientSecret) throws Exception Performs token exchange using OAuth2 Token Exchange flow- Parameters:
tokenUrl- the OIDC token endpoint URLaccessToken- the current access tokencontext- the target context/audienceclientId- the exchange client IDclientSecret- the exchange client secret- Returns:
- JSONObject containing the exchanged token information
- Throws:
Exception- if token exchange fails
-
isTokenValid
Validates if a token is still valid (basic validation)- Parameters:
token- the token to validate- Returns:
- true if token appears valid, false otherwise
-
getTokenInfo
Extracts basic information from a JWT token without validation- Parameters:
token- the JWT token- Returns:
- JSONObject with basic token information
-