Skip to content

docs: explain gateway auth action pattern#1331

Merged
datamweb merged 1 commit into
codeigniter4:developfrom
memleakd:docs/mfa-gateway-actions
Jun 1, 2026
Merged

docs: explain gateway auth action pattern#1331
datamweb merged 1 commit into
codeigniter4:developfrom
memleakd:docs/mfa-gateway-actions

Conversation

@memleakd
Copy link
Copy Markdown
Contributor

Description

This follows up on #1328 and @datamweb's idea about using a conditional action as a small gateway for more complex login flows.

I tried the pattern locally, and it works: an app can register one login action, let appliesTo() decide whether it should run for the user, and then handle the actual method choice inside the action's normal show() / handle() / verify() flow.

This PR adds that pattern to the Authentication Actions docs.

The important detail is that the gateway should still behave like one Shield action. It should return one type from getType() and use that as the pending action identity. The available methods, like email or SMS, should be handled inside the gateway instead of becoming separate action identities.

This documents a useful app-level pattern for people who need one login action to offer more than one verification method.

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@datamweb datamweb added the documentation Improvements or additions to documentation label May 30, 2026
@michalsn
Copy link
Copy Markdown
Member

Please rebase.

@michalsn michalsn requested a review from datamweb May 31, 2026 09:18
Signed-off-by: memleakd <121398829+memleakd@users.noreply.github.com>
@memleakd memleakd force-pushed the docs/mfa-gateway-actions branch from 43dc4cd to d2d33a3 Compare May 31, 2026 10:29
@memleakd
Copy link
Copy Markdown
Contributor Author

Please rebase.

Done

Copy link
Copy Markdown
Collaborator

@datamweb datamweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks!

@datamweb
Copy link
Copy Markdown
Collaborator

datamweb commented Jun 1, 2026

@memleakd @michalsn thanks!

@datamweb datamweb merged commit 5577529 into codeigniter4:develop Jun 1, 2026
2 checks passed
@memleakd memleakd deleted the docs/mfa-gateway-actions branch June 1, 2026 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants