Class OpenIDConnectionUtils


  • public class OpenIDConnectionUtils
    extends Object
    Utility class for OpenID token refresh.
    • Method Detail

      • resolveOIDCTokenFromAuthConfig

        public static CompletableFuture<String> resolveOIDCTokenFromAuthConfig​(Config currentConfig,
                                                                               Map<String,​String> currentAuthProviderConfig,
                                                                               HttpClient.Builder clientBuilder)
        Fetch OpenID Connect token from Kubeconfig, check whether it's still valid or not; If expired handle token refresh with OpenID Connection provider APIs
        Parameters:
        currentAuthProviderConfig - current AuthInfo's AuthProvider config as a map
        Returns:
        access token for interacting with Kubernetes API
      • persistOAuthToken

        public static OpenIDConnectionUtils.OAuthToken persistOAuthToken​(Config currentConfig,
                                                                         OpenIDConnectionUtils.OAuthToken oAuthToken,
                                                                         String token)
        Save Updated Access and Refresh token in local KubeConfig file and in-memory Config object.
        Parameters:
        currentConfig - current Config object.
        oAuthToken - OAuth token information as received from OpenID provider.
        token - new token to be persisted in KubeConfig (if not null).
        Returns:
        the oAuthToken for chaining and further processing.
      • idTokenExpired

        public static boolean idTokenExpired​(Config config)