summaryrefslogtreecommitdiff
path: root/doc.go
diff options
context:
space:
mode:
authorT <t@tjp.lol>2025-07-05 09:41:47 -0600
committerT <t@tjp.lol>2025-07-05 09:55:47 -0600
commitcaf5bb2ee84079365996a622ab8fc5ed510ef9a7 (patch)
tree5caf8bcbcda5ab5c8d70782fb733923c0ac70af3 /doc.go
parent639ad6a02cbb4b713434671ec09f309aa5410921 (diff)
Add Auth.Clear() method and enhance middlewares to clear invalid cookiesHEADmain
- Add Auth.Clear() method that creates expired cookies (MaxAge: -1) to log out users - Enhance Clear() to remove existing Set-Cookie headers to comply with RFC 6265 - Update Required() and Optional() middlewares to automatically clear invalid cookies - Add comprehensive tests for all new functionality - Update documentation with Auth.Clear() usage examples
Diffstat (limited to 'doc.go')
-rw-r--r--doc.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/doc.go b/doc.go
index 8d60f2a..12c314d 100644
--- a/doc.go
+++ b/doc.go
@@ -39,6 +39,9 @@
// user := UserData{ID: 123, Name: "John"}
// auth.Set(w, user)
//
+// // Clear authentication cookie (logout)
+// auth.Clear(w)
+//
// // Get authenticated data
// user, ok := auth.Get(r.Context())
//