MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / HandleLogout

Method HandleLogout

internal/auth/auth.go:434–451  ·  view source on GitHub ↗

HandleLogout deletes the session and clears the cookie.

(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

432
433// HandleLogout deletes the session and clears the cookie.
434func (ua *UserAuth) HandleLogout(w http.ResponseWriter, r *http.Request) {
435 cookie, err := r.Cookie(SessionCookieName)
436 if err == nil {
437 ua.store.DeleteUserSession(r.Context(), cookie.Value)
438 }
439
440 http.SetCookie(w, &http.Cookie{
441 Name: SessionCookieName,
442 Value: "",
443 Path: "/",
444 HttpOnly: true,
445 Secure: ua.secure,
446 SameSite: http.SameSiteLaxMode,
447 MaxAge: -1,
448 })
449
450 w.WriteHeader(http.StatusOK)
451}
452
453// HandleMe returns the current authenticated user's info.
454func (ua *UserAuth) HandleMe(w http.ResponseWriter, r *http.Request) {

Callers

nothing calls this directly

Calls 2

DeleteUserSessionMethod · 0.80
WriteHeaderMethod · 0.45

Tested by

no test coverage detected