Skip to content

Migrate to authMiddleware from initAuthentication#21

Merged
mpscholten merged 4 commits intomasterfrom
migrate-to-auth-middleware
Apr 25, 2026
Merged

Migrate to authMiddleware from initAuthentication#21
mpscholten merged 4 commits intomasterfrom
migrate-to-auth-middleware

Conversation

@mpscholten
Copy link
Copy Markdown
Member

Summary

IHP master removes initAuthentication / fromFrozenContext (in digitallyinduced/ihp#2633) as part of eliminating the ControllerContext TMap. This PR migrates the forum to the new API:

  • Config/Config.hs: register AuthMiddleware (authMiddleware @User . adminAuthMiddleware @Admin)
  • Web/FrontController.hs, Admin/FrontController.hs: drop the initAuthentication call
  • Admin/View/Layout.hs: use currentAdminOrNothing (re-exported from IHP.ViewPrelude via IHP.LoginSupport.Helper.View) instead of the removed fromFrozenContext @(Maybe Admin)

Needed before the core-size benchmark in ihp#2633 can pass.

🤖 Generated with Claude Code

IHP has moved auth from initContext-based initAuthentication to a
WAI middleware (AuthMiddleware). Update the forum to match:

- Config.hs: add AuthMiddleware composing User + Admin
- Web/FrontController.hs and Admin/FrontController.hs: drop
  initAuthentication (no longer exists)
- Admin/View/Layout.hs: use currentAdminOrNothing (from
  IHP.LoginSupport.Helper.View, re-exported from ViewPrelude)
  instead of the removed fromFrozenContext
mpscholten added a commit to digitallyinduced/ihp that referenced this pull request Apr 13, 2026
The ihp-forum master still uses the removed initAuthentication /
fromFrozenContext API. Point the core-size benchmark at the
migrate-to-auth-middleware branch until
digitallyinduced/ihp-forum#21 is merged.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The bare authMiddleware from IHP.LoginSupport.Middleware clashes with
the authMiddleware record field on FrameworkConfig (added in
digitallyinduced/ihp#2259). Use a qualified import to disambiguate.
…AdminRecord

authMiddleware @user needs CurrentUserRecord ~ User to be in scope;
same for Admin. The type family instances live in
Application.Helper.Controller; importing it pulls them in.
Application.Helper.Controller imports Config (for slackWebHook), so
Config/Config.hs can't import back from it without cycling. Extract
the type instance declarations into a tiny leaf module that both can
import safely.
@mpscholten mpscholten merged commit 8595279 into master Apr 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant