Claus Ibsen created CAMEL-27234:
-----------------------------------
Summary: camel-rest-openapi - the camel-http login options given
on the endpoint have no effect, except basic authentication after a 401
Key: CAMEL-27234
URL: https://issues.apache.org/jira/browse/CAMEL-27234
Project: Camel
Issue Type: Improvement
Components: camel-rest-openapi
Reporter: Claus Ibsen
h3. Problem
The rest-openapi endpoint is lenient: options it does not know are passed to
the endpoint of the producer component, such as camel-http. Of the camel-http
login options, only basic authentication answered to a 401 challenge works that
way. Preemptive basic authentication, a bearer token and OAuth2 have no effect:
the request goes out without an {{Authorization}} header, and the OAuth2 token
endpoint is never called. The same options on a plain {{http:}} endpoint work.
This keeps the {{rest-openapi-sink}} Kamelet (apache/camel-kamelets) from
offering the login options that {{http-sink}} has.
h3. Reproduce
Camel 4.24.0-SNAPSHOT (2026-11-19), {{camel run}}, a local HTTP server that
logs the {{Authorization}} header, and an OpenAPI spec with a {{listItems}}
operation ({{GET /items}}) and a {{listProtected}} operation on a path that
answers 401 with {{WWW-Authenticate: Basic}}:
||Endpoint||Authorization received||
|{{rest-openapi:spec.json#listProtected?authUsername=ann&authPassword=secret}}|{{Basic
YW5uOnNlY3JldA==}} after the 401 (works)|
|{{rest-openapi:spec.json#listItems?authMethod=Basic&authUsername=ann&authPassword=secret&authenticationPreemptive=true}}|none|
|{{rest-openapi:spec.json#listItems?authMethod=Bearer&authBearerToken=TOKEN&authenticationPreemptive=true}}|none|
|{{rest-openapi:spec.json#listItems?oauth2ClientId=cid&oauth2ClientSecret=csecret&oauth2TokenEndpoint=...}}|none,
and no token request|
|{{http://127.0.0.1:18099/items?authMethod=Bearer&authBearerToken=TOKEN&authenticationPreemptive=true}}|{{Bearer
TOKEN}}|
|{{http://127.0.0.1:18099/items?authMethod=Basic&authUsername=ann&authPassword=secret&authenticationPreemptive=true}}|{{Basic
YW5uOnNlY3JldA==}}|
|{{http://127.0.0.1:18099/items?oauth2ClientId=cid&...}}|the token request,
then {{Bearer <token>}} (with the token endpoint on another port, see the
OAuth2 pool issue)|
h3. Suggested improvement
Have the producer created for rest-openapi apply the login options given on the
rest-openapi endpoint, as a plain http endpoint does: {{authMethod}},
{{authUsername}}, {{authPassword}}, {{authBearerToken}},
{{authenticationPreemptive}} and the {{oauth2*}} options.
{{RestOpenApiEndpoint}} hands them to {{HttpComponent.createProducer}} as
{{parameters}}, which calls {{camelContext.getEndpoint(url, parameters)}}; the
options that {{createHttpClientConfigurer}} reads seem not to be applied on
that path.
_Claude Code on behalf of Claus Ibsen_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)