Class WorkloadIdentityFederationClient

    • Constructor Detail

      • WorkloadIdentityFederationClient

        public WorkloadIdentityFederationClient​(String tokenExchangeEndpoint,
                                                Supplier<String> subjectTokenSupplier,
                                                SessionKeySupplier sessionKeySupplier,
                                                String clientCredentials,
                                                Map<String,​String> requestPayload,
                                                Boolean isInstanceCertificatesRequired,
                                                ClientConfigurator clientConfigurator,
                                                CircuitBreakerConfiguration circuitBreakerConfiguration,
                                                List<ClientConfigurator> additionalClientConfigurators,
                                                Long earlySessionTokenExpirationInSeconds,
                                                boolean enableProactiveRefresh,
                                                RetryConfiguration tokenExchangeRetryConfiguration)
        Constructor of WorkloadIdentityFederationClient.
        Parameters:
        tokenExchangeEndpoint - the identity cloud service token endpoint
        subjectTokenSupplier - the subject token supplier
        sessionKeySupplier - the session key supplier.
        clientCredentials - the client credential of OAuth application
        requestPayload - the map of parameters to send to server
        clientConfigurator - the reset client configurator.
        circuitBreakerConfiguration - the rest client circuit breaker configuration.
        additionalClientConfigurators - additional client configurators to be run after the primary configurator.
        earlySessionTokenExpirationInSeconds - the number of seconds to refresh token before it expires
        enableProactiveRefresh - control of proactive refresh
        tokenExchangeRetryConfiguration - SDK retry configuration to use
    • Method Detail

      • getSecurityToken

        public CompletableFuture<String> getSecurityToken()
        Overrides the base implementation to provide proactive token refresh behavior.

        Unlike the base class which only refreshes tokens when they are already invalid, this implementation refreshes tokens early (before expiration) to prevent authentication failures in workload identity scenarios where timing is critical.

        The early refresh is controlled by earlySessionTokenExpirationInSeconds (default 5 minutes), ensuring tokens are renewed well before they expire to avoid any risk of using an expired token during authentication.

        Specified by:
        getSecurityToken in interface AsyncFederationClient
        Overrides:
        getSecurityToken in class AbstractAsyncFederationClient
        Returns:
        CompletableFuture containing the security token
      • getStringClaim

        public String getStringClaim​(String key)
        Description copied from interface: AsyncFederationClient
        Get a claim embedded in the security token.

        May use the cached token if it is judged to still be valid.

      • shutdown

        public void shutdown()
        Shuts down the proactive refresh scheduler.

        This method should be called when the client is no longer needed to clean up resources.