mirror of
https://github.com/floci-io/floci.git
synced 2026-11-27 07:39:24 -05:00
fix: allow Cognito custom authentication without CreateAuthChallenge (#6410)
createAuthChallenge now returns an empty map when the trigger is absent, matching a no-op trigger response. Configured triggers still follow the existing invocation and error handling. Added coverage compares absent and no-op triggers, checks required decisions and configured-trigger failures, and exercises multiple challenge rounds through both admin and non-admin APIs, including session reuse rejection and token issuance. Fixes #6345 Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
This commit is contained in:
1 parent
2a1d3f3cec
commit
6256805c33
3 files changed
+235
-3
No files matched your search
@@ -42,6 +42,7 @@ import java.util.function.Function;
|
||||
*
|
||||
* For CUSTOM_AUTH, dispatches Cognito Lambda triggers
|
||||
* (DefineAuthChallenge, CreateAuthChallenge, VerifyAuthChallengeResponse).
|
||||
* CreateAuthChallenge is optional; decision and custom-challenge verification triggers are required.
|
||||
* CUSTOM_AUTH is trigger-driven: if any required trigger is not configured,
|
||||
* invocation fails, or the response is incomplete, authentication fails.
|
||||
*
|
||||
@@ -1579,6 +1580,9 @@ final class CognitoAuthFlowHandler {
|
||||
|
||||
private Map<String, Object> createAuthChallenge(UserPool pool, UserPoolClient client, CognitoUser user,
|
||||
CustomAuthSession state, String challengeName) {
|
||||
if (resolveTriggerArn(pool, "CreateAuthChallenge") == null) {
|
||||
return Map.of();
|
||||
}
|
||||
Map<String, Object> req = new HashMap<>();
|
||||
req.put("challengeName", challengeName);
|
||||
req.put("session", new ArrayList<>(state.history));
|
||||
|
||||
Reference in new issue
Block a user