feat(auth): /access callback, nextwks.eu cookie domain
This commit is contained in:
parent
7d432d0af5
commit
43b32cc881
2 changed files with 6 additions and 6 deletions
|
|
@ -22,7 +22,7 @@ oidc:
|
||||||
issuer_url: "https://auth.lohmar.co.uk"
|
issuer_url: "https://auth.lohmar.co.uk"
|
||||||
client_id: "nextwks"
|
client_id: "nextwks"
|
||||||
client_secret: ""
|
client_secret: ""
|
||||||
redirect_url: "https://wks.lohmar.co.uk/auth/callback"
|
redirect_url: "https://wks.lohmar.co.uk/access"
|
||||||
domain: "wks.lohmar.co.uk"
|
domain: "wks.lohmar.co.uk"
|
||||||
|
|
||||||
smtp:
|
smtp:
|
||||||
|
|
|
||||||
10
src/main.go
10
src/main.go
|
|
@ -108,14 +108,14 @@ func main() {
|
||||||
// Setup HTTP router
|
// Setup HTTP router
|
||||||
mux := http.NewServeMux()
|
mux := http.NewServeMux()
|
||||||
|
|
||||||
// Reverse proxy: /auth/* → Authelia (except /auth/callback)
|
// Reverse proxy: /auth/* → Authelia (except /access)
|
||||||
autheliaProxy := httputil.NewSingleHostReverseProxy(&url.URL{
|
autheliaProxy := httputil.NewSingleHostReverseProxy(&url.URL{
|
||||||
Scheme: "http",
|
Scheme: "http",
|
||||||
Host: fmt.Sprintf("%s:%d", "127.0.0.1", 9091),
|
Host: fmt.Sprintf("%s:%d", "127.0.0.1", 9091),
|
||||||
})
|
})
|
||||||
mux.HandleFunc("GET /auth/", func(w http.ResponseWriter, r *http.Request) {
|
mux.HandleFunc("GET /auth/", func(w http.ResponseWriter, r *http.Request) {
|
||||||
// Skip /auth/callback and /auth/login /auth/logout — handled by NextWks
|
// Skip /access — handled by NextWks
|
||||||
if r.URL.Path == "/auth/callback" || r.URL.Path == "/auth/login" || r.URL.Path == "/auth/logout" {
|
if r.URL.Path == "/access" || r.URL.Path == "/auth/login" || r.URL.Path == "/auth/logout" {
|
||||||
http.NotFound(w, r)
|
http.NotFound(w, r)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -137,8 +137,8 @@ func main() {
|
||||||
|
|
||||||
// --- OIDC auth routes (public) ---
|
// --- OIDC auth routes (public) ---
|
||||||
mux.HandleFunc("GET /auth/login", oidcHandler.LoginRedirect)
|
mux.HandleFunc("GET /auth/login", oidcHandler.LoginRedirect)
|
||||||
mux.HandleFunc("GET /auth/callback", oidcHandler.Callback)
|
mux.HandleFunc("GET /access", oidcHandler.Callback)
|
||||||
mux.HandleFunc("POST /auth/callback", oidcHandler.Callback)
|
mux.HandleFunc("POST /access", oidcHandler.Callback)
|
||||||
mux.HandleFunc("GET /auth/logout", func(w http.ResponseWriter, r *http.Request) {
|
mux.HandleFunc("GET /auth/logout", func(w http.ResponseWriter, r *http.Request) {
|
||||||
// Check if this is the return from Authelia logout (no NextWks cookie)
|
// Check if this is the return from Authelia logout (no NextWks cookie)
|
||||||
if _, err := r.Cookie("nextwks_session"); err != nil {
|
if _, err := r.Cookie("nextwks_session"); err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue