Skip to content
Snippets Groups Projects
Commit fb70a0de authored by Christian Pointner's avatar Christian Pointner
Browse files

implemented logout handler

parent bc3764d0
Branches
Tags
No related merge requests found
......@@ -68,8 +68,19 @@ func Login(w http.ResponseWriter, r *http.Request) {
}
}
func Logout(w http.ResponseWriter, r *http.Request) {
_, s := getSessionFromCookie(r)
invalidateSessionCookie(w)
if s == nil {
http.Error(w, "Request does not contain a valid session cookie or session is already expired.", http.StatusUnauthorized)
return
}
http.Error(w, "You are now logged out.", http.StatusOK)
}
func InstallHTTPHandler(r *mux.Router) {
r.HandleFunc("/login", Login)
r.HandleFunc("/logout", Logout)
if auth.oidc != nil {
r.Handle("/oidc/callback", auth.oidc.CallbackHandler())
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment