mirror of
https://git.sr.ht/~sircmpwn/tokidoki
synced 2025-12-12 14:17:21 +01:00
Keep context keys private
Instead, offer type safe accessors, as documented here: https://pkg.go.dev/context#Context
This commit is contained in:
parent
07c19a6f6c
commit
78bd2a9b84
3 changed files with 18 additions and 11 deletions
|
|
@ -1,7 +1,6 @@
|
|||
package auth
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
|
|
@ -59,7 +58,7 @@ func (prov *IMAPProvider) doAuth(next http.Handler,
|
|||
AuthMethod: "imap",
|
||||
UserName: user,
|
||||
}
|
||||
ctx := context.WithValue(r.Context(), AuthCtxKey, &authCtx)
|
||||
ctx := NewContext(r.Context(), &authCtx)
|
||||
r = r.WithContext(ctx)
|
||||
next.ServeHTTP(w, r)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue