Skip to content

enterprise: add required actions for users - #24846

Merged
dominic-r merged 22 commits into
mainfrom
dominic/next-actions/enforce
Nov 1, 2026
Merged

dominic-r merged 22 commits into
mainfrom
dominic/next-actions/enforce

Conversation

@dominic-r

@dominic-r dominic-r commented Aug 6, 2026 •

Copy link
Copy Markdown
Member

Details

What does this PR change?

Adds required actions, an Enterprise feature. A user's goauthentik.io/user/required-actions attribute lists flows they must complete before they can use authentik. On their next request, including in a session that's already logged in, authentik pauses what they were doing and runs each flow in order. Afterwards, it resumes the page or flow they were in. Each completed flow is removed from the attribute and logged as a Required action completed event.

Following review, the User Login and Redirect stages are untouched. A flow in progress is suspended on the action's completion stage and restored afterwards, the way the Source stage does it, rather than having stages spliced into other flows. The feature is renamed from "next actions" now that it isn't tied to login.

Why is this change needed?

Admins can't make a user change their password or set up an authenticator without building their own flows and policies.

How was this tested?

Tests cover login, an existing session, a flow suspended mid-way and resumed, a resumed POST, several and replaced actions, invalid actions failing closed, license states, impersonation, and what a restricted session can reach.

I also ran the stack locally with license validation stubbed the way the tests do it. I added default-password-change to a user from the admin card in #24850 and logged in as that user. authentik sent them to the password change instead of the user interface, and after they changed it they landed on the user interface with the action cleared and the event recorded.

Linked issues

closes #19681
closes #25310

Screenshots

The user is sent to their required action:

Password change flow with a "Complete the required actions before continuing" message

The admin card from #24850:

Required actions card on the user page

The new event:

Required action completed event in the event log


Checklist

  • The project has been linted, built, and tested (make all)
  • The documentation has been updated and formatted (make docs)
  • I have read the AI usage policy.

@dominic-r
dominic-r requested a review from a team as a code owner August 6, 2026 18:49
@dominic-r dominic-r self-assigned this Aug 6, 2026
@dominic-r dominic-r added this to the Release 2026.11.0: Required milestone Aug 6, 2026
@netlify

netlify Bot commented Aug 6, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for authentik-integrations ready!

Name Link
🔨 Latest commit d5ed345
🔍 Latest deploy log https://app.netlify.com/projects/authentik-integrations/deploys/6a78b6181beb3400081c6ce5
😎 Deploy Preview https://deploy-preview-24846--authentik-integrations.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Aug 6, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for authentik-docs ready!

Name Link
🔨 Latest commit d5ed345
🔍 Latest deploy log https://app.netlify.com/projects/authentik-docs/deploys/6a78b618ede77f000881f104
😎 Deploy Preview https://deploy-preview-24846--authentik-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI lite review requested due to automatic review settings August 6, 2026 19:38
@dominic-r
dominic-r requested a review from a team as a code owner August 6, 2026 19:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@dominic-r
dominic-r force-pushed the dominic/next-actions/enforce branch from f5975c1 to 4447fbd Compare August 6, 2026 19:49
Copilot AI review requested due to automatic review settings August 6, 2026 20:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings August 6, 2026 20:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings August 7, 2026 14:49
@dominic-r
dominic-r force-pushed the dominic/next-actions/enforce branch from 17e1f32 to caedd92 Compare August 7, 2026 14:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Comment thread authentik/core/api/users.py Fixed
@codecov

codecov Bot commented Aug 7, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.73%. Comparing base (98c4b28) to head (be25594).
⚠️ Report is 48 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #24846      +/-   ##
==========================================
+ Coverage   92.48%   92.73%   +0.25%     
==========================================
  Files        1197     1204       +7     
  Lines       81116    82371    +1255     
  Branches     4497     4686     +189     
==========================================
+ Hits        75017    76388    +1371     
+ Misses       6033     5907     -126     
- Partials       66       76      +10     
Flag Coverage Δ
conformance 30.88% <13.39%> (-0.26%) ⬇️
e2e 35.69% <13.39%> (-0.32%) ⬇️
integration 28.37% <12.47%> (-0.26%) ⬇️
rust 49.31% <ø> (+3.33%) ⬆️
unit 94.29% <100.00%> (+0.16%) ⬆️
unit-migrate 94.28% <100.00%> (+0.16%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@dominic-r
dominic-r force-pushed the dominic/next-actions/enforce branch 2 times, most recently from 6110a14 to b0cf6c6 Compare August 9, 2026 17:14
@dominic-r dominic-r linked an issue Aug 9, 2026 that may be closed by this pull request
@github-actions

github-actions Bot commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

authentik PR Installation instructions

Instructions for docker-compose

Add the following block to your .env file:

AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-304644d8f514906f68508fbcce9df734450f2b61
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s

Afterwards, run the upgrade commands from the latest release notes.

Instructions for Kubernetes

Add the following block to your values.yml file:

authentik:
    outposts:
        container_image_base: ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
global:
    image:
        repository: ghcr.io/goauthentik/dev-server
        tag: gh-304644d8f514906f68508fbcce9df734450f2b61

Afterwards, run the upgrade commands from the latest release notes.

@dominic-r
dominic-r force-pushed the dominic/next-actions/enforce branch from 979edcc to 400e27c Compare October 4, 2026 19:20
Comment thread authentik/stages/redirect/stage.py Fixed

@dominic-r dominic-r left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

q for myself: what if starts oidc flow, what happens to your next action

@BeryJu BeryJu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm not the biggest fan of splicing flows together, I think I kinda prefer what the source stage does with suspending/pausing one flow and running another

Aside from that, don't like the naming (not a big issue)

Also the other thing I'd like to be able to do with a system like this is to "require" them to go through a flow, even if they have a session that's already authenticated. In theory you could use this and just revoke their sessions, but imo it would be cleaner to just click a button on user x forcing them to change their password/re-enroll MFA/etc and the next request they send would cause them to be in that flow and not be able to do anything else

Review asked for three changes: pause and resume flows the way the
Source stage does instead of splicing a completion stage into other
flows, apply actions to sessions that already exist, and a clearer name.

The middleware now reads goauthentik.io/user/required-actions on every
authenticated request, so an action added to a logged-in user applies on
their next request and the User Login stage needs no hook. Starting an
action suspends what the user was doing: a flow in progress is kept on
the action's completion stage and restored afterwards, and any other
page is opened again. The Redirect stage hook is gone, so an action flow
can no longer hand off to another flow.

The set and removed events are dropped because the user's model_updated
event already records the attribute change. Validation only runs when
the value changes, so a deleted flow doesn't block unrelated edits.
Reject flows that a logged-in user can never plan, such as the
unauthenticated recovery and enrollment flows, which would otherwise
lock the user out. Keep the body of a suspended POST in the session,
as the login redirect does, so a SAML POST binding still works once the
actions are done. Complete the action for the plan's pending user, so a
plan restored in another browser from an email link doesn't fail.
@dominic-r dominic-r changed the title stages/user_login: require next action flows before login enterprise: add required actions for users Oct 10, 2026

@kensternberg-authentik kensternberg-authentik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Wow. One front-end line. :-).

dominic-r and others added 2 commits October 28, 2026 21:54
Otherwise an Email stage can fail with "No pending user." and leave
the user stuck.
@github-project-automation github-project-automation Bot moved this from Todo to In Progress in authentik Core Nov 1, 2026
@dominic-r
dominic-r merged commit 1be557e into main Nov 1, 2026
171 checks passed
@dominic-r
dominic-r deleted the dominic/next-actions/enforce branch November 1, 2026 17:42
@github-project-automation github-project-automation Bot moved this from In Progress to Done in authentik Core Nov 1, 2026
@regiolis

regiolis commented Nov 1, 2026

Copy link
Copy Markdown

Is this going to be Enterprise-only? The part about the restriction staying active after an Enterprise license expires reads that way, though I might be misreading it.

If it is, I think it's the wrong call. Forcing a user to complete something before they can get in, like enrolling MFA or changing a password, isn't an advanced feature. It's the basic mechanism you need to roll MFA out to accounts that already exist. Keycloak has had the same thing in the free version for years, they call it required actions.

Related question while you're here: would next actions cover the Active Directory case where an account is flagged "user must change password at next logon"? With an LDAP source the bind comes back with error 773 and pwdLastSet is 0, and I haven't found a way to turn that into a forced password change at login. Keycloak maps it to its update password action automatically. If next actions is where that would end up living, that's one more reason not to put it behind a license.

For self-hosted setups this is the difference between being able to enforce MFA and not being able to. Security controls that sit behind a license are the ones that end up never getting turned on.

I get that the project needs money and I'd happily pay for support, but this isn't the thing to charge for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Force password change at next logon, including the AD flag 773 case Force password reset on next login Forcing users into next actions

7 participants