oscerd opened a new pull request, #31274: URL: https://github.com/apache/camel/pull/31274
## Problem `getSessionToken` built an empty request: ```java GetSessionTokenRequest.Builder builder = GetSessionTokenRequest.builder(); result = stsClient.getSessionToken(builder.build()); ``` `durationSeconds`, `serialNumber` and `tokenCode` were never read and no header constants existed for them, so the operation always returned a default-duration token and **could not be used at all under a policy that enforces MFA** — the only way out was `pojoRequest=true`. `getFederationToken` set the federated name and nothing else, so its session always took the STS default duration. `assumeRole` in the same class does read `CamelAwsStsAssumeRoleDurationSeconds`, so the two were the odd ones out. ## Changes | header | operations | purpose | |---|---|---| | `CamelAwsStsDurationSeconds` | getSessionToken, getFederationToken | session length (900–129600s) | | `CamelAwsStsSerialNumber` | getSessionToken | MFA device ARN or serial | | `CamelAwsStsTokenCode` | getSessionToken | the one-time code | `assumeRole` keeps `CamelAwsStsAssumeRoleDurationSeconds` — it is published API and its allowed range differs (role chaining caps at 3600), so a single shared header would have been misleading. The two MFA headers must be set together: one without the other fails the exchange with a message naming both, instead of letting STS reject the call after a round trip. Docs: a section on the duration of each operation, and one on the MFA flow with an example. It notes that the one-time code should be read from the message that carries it rather than stored in the route. ## Tests `AmazonSTSClientMock` now records the last request of both operations — nothing could inspect what the producer sent before. Four tests, three of which fail against unmodified code: the headers reach the SDK request, an unset header leaves the field null, a serial number without a token code is rejected, and the federation duration is passed. ## Not in this PR CAMEL-28031 also reports three larger items; **the ticket should stay open**: - no `sessionToken` / `useSessionCredentials`, so role chaining is impossible — a credentials-configuration change - no `getCallerIdentity` - `STS2Component` extends `DefaultComponent`, so there are no `healthCheck*` options The `required = true` plus `defaultValue` contradiction on `operation` is left to the family-wide CAMEL-28047. `policy`/`policyArns` for `getFederationToken` remain POJO-only; that limitation is already documented on `CamelAwsStsFederatedName`. ## Testing `mvn test` in `components/camel-aws/camel-aws2-sts`: 27 tests, all passing. _Claude Code on behalf of oscerd_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
