middleware.Chain. Everything is in-memory;
there is no database or external dependency to stand up.
Running it
log.Fatal) if REMEMBER_ME_KEY is unset or shorter than 32 bytes,
since a committed key would let anyone with repo access forge remember-me
tokens.
The chain, top to bottom
/login and /logout endpoints are mounted on a mux that the chain
wraps.
Key configuration
Users, encoder, manager
Session store
Remember-me
The fetcher returns a fragment of the user’s stored password hash, so a password change invalidates outstanding remember-me tokens automatically — no separate revocation list to maintain:CSRF (session-backed synchronizer token)
CORS
The one chain that wraps everything
sessionResolver is a small example middleware, not a library type: it reads
the SESSION cookie, loads the session, and reloads the user’s authorities
from the UserService on every request — so a revoked role or a disabled/
locked account takes effect immediately rather than being frozen at login
time.
Trying it out
The running process listens on plainhttp://localhost:8080 (see
http.ListenAndServe(":8080", handler) in main); the package doc comment’s
https://localhost:8443 curl example describes a real TLS-terminated
deployment, not this exact process.
/me has no authz route rule guarding it, so it is reachable
unauthenticated — core.MustAuthentication never panics because Anonymous()
always puts some authentication (anonymous or real) on the context:
