Class OIDCTokenService

java.lang.Object
org.gcube.portlets.admin.service.OIDCTokenService

public class OIDCTokenService extends Object
Service for handling OIDC token exchange operations
Author:
netfarm-m2
  • 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 URL
      accessToken - the current access token
      context - the target context/audience
      clientId - the exchange client ID
      clientSecret - the exchange client secret
      Returns:
      JSONObject containing the exchanged token information
      Throws:
      Exception - if token exchange fails
    • isTokenValid

      public boolean isTokenValid(String token)
      Validates if a token is still valid (basic validation)
      Parameters:
      token - the token to validate
      Returns:
      true if token appears valid, false otherwise
    • getTokenInfo

      public com.liferay.portal.kernel.json.JSONObject getTokenInfo(String token)
      Extracts basic information from a JWT token without validation
      Parameters:
      token - the JWT token
      Returns:
      JSONObject with basic token information