Package org.apache.camel.spi
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 Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionresolveToken(CamelContext context) Resolves a bearer token using the default (unnamed) profile.resolveToken(CamelContext context, String profileName) Resolves a bearer token using a named profile from Camel properties.resolveToken(OAuthClientConfig config) Resolves a bearer token using explicit configuration.
-
Field Details
-
FACTORY
Service factory key.- See Also:
-
-
Method Details
-
resolveToken
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
Resolves a bearer token using a named profile from Camel properties. Properties are resolved fromcamel.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 fromprofileName- the named profile (e.g., "keycloak", "azure")- Returns:
- the bearer token string
- Throws:
Exception- if required properties are missing or token acquisition fails
-
resolveToken
Resolves a bearer token using the default (unnamed) profile. Properties are resolved fromcamel.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
-