mirror of
https://github.com/go-admin-team/go-admin.git
synced 2026-09-21 18:20:50 +00:00
Four modules each called AuthInit and built their own instance, so which one Runtime handed back was decided by whichever module initialised last. The JwtToken key was also registered as an unbound method expression, which GetHandlerFunc's type assertion can never match - the key was registered and unusable at the same time. The instance is now built once here and registered as a bound closure. Modules read it back through GetAuthMiddleware, which is fatal rather than nil when called before InitMiddleware has run: a process without a JWT middleware should not reach the point of serving a request. Only one call site needs the instance itself rather than the handler (admin's /login, for LoginHandler); the thirty-odd MiddlewareFunc() call sites are unchanged. Claude-Session: https://claude.ai/code/session_01HPTAw8b8tAdFNFn8rKdPYx