forked from TrueCloudLab/frostfs-s3-gw
api: fix golint suggestion for proper context usage
api/user-auth.go:27:5 golint should not use basic type string as key in context.WithValue Signed-off-by: Roman Khimov <roman@nspcc.ru>
This commit is contained in:
parent
184c26551a
commit
1c277bd97b
1 changed files with 4 additions and 1 deletions
|
@ -9,8 +9,11 @@ import (
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// KeyWrapper is wrapper for context keys.
|
||||||
|
type KeyWrapper string
|
||||||
|
|
||||||
// BearerTokenKey is an ID used to store bearer token in a context.
|
// BearerTokenKey is an ID used to store bearer token in a context.
|
||||||
const BearerTokenKey = "__context_bearer_token_key"
|
var BearerTokenKey = KeyWrapper("__context_bearer_token_key")
|
||||||
|
|
||||||
// AttachUserAuth adds user authentication via center to router using log for logging.
|
// AttachUserAuth adds user authentication via center to router using log for logging.
|
||||||
func AttachUserAuth(router *mux.Router, center auth.Center, log *zap.Logger) {
|
func AttachUserAuth(router *mux.Router, center auth.Center, log *zap.Logger) {
|
||||||
|
|
Loading…
Reference in a new issue