oscerd commented on code in PR #31274:
URL: https://github.com/apache/camel/pull/31274#discussion_r4782776990


##########
components/camel-aws/camel-aws2-sts/src/main/java/org/apache/camel/component/aws2/sts/STS2Producer.java:
##########
@@ -166,6 +166,22 @@ private void getSessionToken(StsClient stsClient, Exchange 
exchange) throws Inva
             }
         } else {
             GetSessionTokenRequest.Builder builder = 
GetSessionTokenRequest.builder();
+            Integer durationSeconds = 
exchange.getIn().getHeader(STS2Constants.DURATION_SECONDS, Integer.class);
+            if (ObjectHelper.isNotEmpty(durationSeconds)) {
+                builder.durationSeconds(durationSeconds);
+            }
+            String serialNumber = 
exchange.getIn().getHeader(STS2Constants.SERIAL_NUMBER, String.class);
+            String tokenCode = 
exchange.getIn().getHeader(STS2Constants.TOKEN_CODE, String.class);
+            if (ObjectHelper.isNotEmpty(serialNumber) != 
ObjectHelper.isNotEmpty(tokenCode)) {
+                throw new IllegalArgumentException(
+                        "The " + STS2Constants.SERIAL_NUMBER + " and " + 
STS2Constants.TOKEN_CODE
+                                                   + " headers of 
getSessionToken are set together, as MFA needs both the"
+                                                   + " device and its one-time 
code");
+            }

Review Comment:
   Changed to "must be set together" in (b7de8c820b06), with the assertion in 
`STS2ProducerTest` following.
   
   _Claude Code on behalf of oscerd_



-- 
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]

Reply via email to