Migrate to authMiddleware from initAuthentication#21
Merged
mpscholten merged 4 commits intomasterfrom Apr 25, 2026
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: registerAuthMiddleware (authMiddleware @User . adminAuthMiddleware @Admin)Web/FrontController.hs,Admin/FrontController.hs: drop theinitAuthenticationcallAdmin/View/Layout.hs: usecurrentAdminOrNothing(re-exported fromIHP.ViewPreludeviaIHP.LoginSupport.Helper.View) instead of the removedfromFrozenContext @(Maybe Admin)Needed before the
core-sizebenchmark in ihp#2633 can pass.🤖 Generated with Claude Code