Interface OAuthClientAuthenticationFactory


public interface OAuthClientAuthenticationFactory
Factory for resolving OAuth 2.0 bearer tokens using the client_credentials grant.

This requires camel-oauth on the classpath.

  • Field Details

  • Method Details

    • resolveToken

      String resolveToken(OAuthClientConfig config) throws Exception
      Resolves a bearer token using explicit configuration.

      Acquires a token from the configured token endpoint using the client_credentials grant. Tokens are cached if caching is enabled in the config.

      Parameters:
      config - the OAuth client configuration
      Returns:
      the bearer token string
      Throws:
      Exception - if token acquisition fails
    • resolveToken

      String resolveToken(CamelContext context, String profileName) throws Exception
      Resolves a bearer token using a named profile from Camel properties.

      Properties are resolved from camel.oauth.<profileName>.*:

      • camel.oauth.<profileName>.client-id (required)
      • camel.oauth.<profileName>.client-secret (required)
      • camel.oauth.<profileName>.token-endpoint (required)
      • camel.oauth.<profileName>.scope (optional)
      • camel.oauth.<profileName>.cache-tokens (optional, default true)
      • camel.oauth.<profileName>.cached-tokens-default-expiry-seconds (optional, default 3600)
      • camel.oauth.<profileName>.cached-tokens-expiration-margin-seconds (optional, default 5)
      Parameters:
      context - the CamelContext to resolve properties from
      profileName - the named profile (e.g., "keycloak", "azure")
      Returns:
      the bearer token string
      Throws:
      Exception - if required properties are missing or token acquisition fails
    • resolveToken

      String resolveToken(CamelContext context) throws Exception
      Resolves a bearer token using the default (unnamed) profile.

      Properties are resolved from camel.oauth.* directly (backward compatible with existing single-IdP configuration).

      Parameters:
      context - the CamelContext to resolve properties from
      Returns:
      the bearer token string
      Throws:
      Exception - if required properties are missing or token acquisition fails