Federico Mariani created CAMEL-27121:
----------------------------------------
Summary: camel-oauth - client profiles: token exchange (RFC 8693),
JWT bearer grant (RFC 7523) and client authentication with an assertion such as
a SPIFFE JWT-SVID
Key: CAMEL-27121
URL: https://issues.apache.org/jira/browse/CAMEL-27121
Project: Camel
Issue Type: Sub-task
Components: camel-oauth
Reporter: Federico Mariani
camel-oauth client profiles ({{camel.oauth.<profile>.*}}) only implement the
client credentials grant with a client secret ({{OAuthClientConfig}}: client
id, secret, token endpoint, scope). Add:
*Grants* ({{grant-type}}):
* {{token-exchange}} (RFC 8693). The subject token is the validated token of
the caller of the current exchange, so the profile acts on behalf of that user;
it requires {{retain-token=true}} on the consumer validation profile. Options
{{audience}}, {{resource}}, {{scope}}, {{requested-token-type}},
{{subject-token-type}}. Exchanged tokens are cached per subject token
(fingerprint), never shared between users.
* {{token-exchange}} with a {{subject-token-provider}}: the subject token is
the workload JWT instead of the caller token. This is the workload identity
federation of OpenAI ({{https://auth.openai.com/oauth/token}}, JSON body,
{{subject_token_type}} {{urn:ietf:params:oauth:token-type:jwt}},
{{identity_provider_id}}, {{service_account_id}}).
* {{jwt-bearer}} (RFC 7523 section 2.1), with {{assertion-provider}} and
{{assertion-audience}}: the workload identity federation of Anthropic
({{/v1/oauth/token}}).
* {{assertion}}: no token endpoint, the assertion itself is the bearer token (a
JWT-SVID for another workload).
*Client authentication* ({{client-authentication}}): {{client_secret_basic}}
(today), {{client_secret_post}}, {{none}}, and {{client_assertion}} with
{{client-assertion-provider}}, {{client-assertion-type}} ({{jwt-bearer}} or
{{jwt-spiffe}}, draft-ietf-oauth-spiffe-client-auth) and
{{client-assertion-audience}}. No client secret is needed with a SPIFFE
JWT-SVID (Keycloak federated client authentication).
*Request shape*: {{extra-parameter.<name>}} for provider-specific parameters,
and {{token-request-format=json}}, as both workload identity federation
endpoints above take JSON.
*Validation profiles*: {{retain-token}} (default false) keeps the validated
bearer token on {{OAuthTokenValidationResult}} ({{getBearerToken()}}, never
printed by {{toString()}}), so that a token exchange profile can use it. The
token is never copied to a message header.
*SPI* (camel-api, {{@since 4.24}}): {{OAuthAssertionProvider}} ({{String
getAssertion(String audience)}}), the new {{OAuthClientConfig}} fields,
{{OAuthClientAuthenticationFactory.resolveToken(Exchange, String)}} and
{{OAuthHelper.resolveOAuthToken(Exchange, String)}}, so a component can resolve
a token for the exchange it processes.
A prototype was run against Keycloak 26.8.2 (standard token exchange, SPIFFE
federated client authentication) and SPIRE 1.15.3; the
{{subject-token-provider}} variant was not prototyped.
_Claude Code on behalf of Federico Mariani_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)