feat(auth): /access callback, nextwks.eu cookie domain

This commit is contained in:
Claus Lohmar 2026-06-15 20:06:34 +00:00
parent 7d432d0af5
commit 43b32cc881
2 changed files with 6 additions and 6 deletions

View file

@ -22,7 +22,7 @@ oidc:
issuer_url: "https://auth.lohmar.co.uk"
client_id: "nextwks"
client_secret: ""
redirect_url: "https://wks.lohmar.co.uk/auth/callback"
redirect_url: "https://wks.lohmar.co.uk/access"
domain: "wks.lohmar.co.uk"
smtp:

View file

@ -108,14 +108,14 @@ func main() {
// Setup HTTP router
mux := http.NewServeMux()
// Reverse proxy: /auth/* → Authelia (except /auth/callback)
// Reverse proxy: /auth/* → Authelia (except /access)
autheliaProxy := httputil.NewSingleHostReverseProxy(&url.URL{
Scheme: "http",
Host: fmt.Sprintf("%s:%d", "127.0.0.1", 9091),
})
mux.HandleFunc("GET /auth/", func(w http.ResponseWriter, r *http.Request) {
// Skip /auth/callback and /auth/login /auth/logout — handled by NextWks
if r.URL.Path == "/auth/callback" || r.URL.Path == "/auth/login" || r.URL.Path == "/auth/logout" {
// Skip /access — handled by NextWks
if r.URL.Path == "/access" || r.URL.Path == "/auth/login" || r.URL.Path == "/auth/logout" {
http.NotFound(w, r)
return
}
@ -137,8 +137,8 @@ func main() {
// --- OIDC auth routes (public) ---
mux.HandleFunc("GET /auth/login", oidcHandler.LoginRedirect)
mux.HandleFunc("GET /auth/callback", oidcHandler.Callback)
mux.HandleFunc("POST /auth/callback", oidcHandler.Callback)
mux.HandleFunc("GET /access", oidcHandler.Callback)
mux.HandleFunc("POST /access", oidcHandler.Callback)
mux.HandleFunc("GET /auth/logout", func(w http.ResponseWriter, r *http.Request) {
// Check if this is the return from Authelia logout (no NextWks cookie)
if _, err := r.Cookie("nextwks_session"); err != nil {