diff options
| author | Martin Kagamino Lehoux <martin@lehoux.net> | 2025-12-24 19:19:44 +0100 |
|---|---|---|
| committer | Martin Kagamino Lehoux <martin@lehoux.net> | 2025-12-24 19:19:44 +0100 |
| commit | 81ca1bd74bfad653315cfd30aebff2c6c43a7bbf (patch) | |
| tree | d5a595c6ca2c236a60060a62353c5d028d352709 /kauth/cookie.go | |
| parent | 73c12bd85076cfc47f5d06f7d2c557d790b66b94 (diff) | |
Implements cookie authentication enhancements
Improves cookie authentication by adding error handling for expired and bad format cookies.
Enhances user session management through robust checks and logging, ensuring a secure and reliable authentication process.
Updates the README to reflect changes in the authentication mechanism.
Diffstat (limited to 'kauth/cookie.go')
| -rw-r--r-- | kauth/cookie.go | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/kauth/cookie.go b/kauth/cookie.go deleted file mode 100644 index edc30b7..0000000 --- a/kauth/cookie.go +++ /dev/null @@ -1,21 +0,0 @@ -package kauth - -import ( - "fmt" - "net/http" - "time" - - "github.com/martinlehoux/kagamigo/kcore" -) - -func CraftCookie(id kcore.ID, config AuthConfig) http.Cookie { - expiresAt := time.Now().Add(24 * time.Hour) - cookieValue := encrypt(config.CookieSecret, fmt.Sprintf("%s:%d", id.String(), expiresAt.Unix())) - return http.Cookie{ - Domain: config.Domain, - Name: "authentication", - Value: cookieValue, - Expires: expiresAt, - Path: "/", - } -} |
