From 2279904420fd6c1d27e86b0c6435a71a8ac61def Mon Sep 17 00:00:00 2001 From: Amid Date: Sat, 20 Mar 2021 16:26:42 +0330 Subject: [PATCH] Fixed a typo in JWT package (#1071) * define JWTContextKey as a new constant * mark JWTTokenContextKey as a deprecated constant * revise corresponding error messages --- auth/jwt/middleware.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/auth/jwt/middleware.go b/auth/jwt/middleware.go index dd765ed1b..0b0ad76fb 100644 --- a/auth/jwt/middleware.go +++ b/auth/jwt/middleware.go @@ -12,9 +12,14 @@ import ( type contextKey string const ( - // JWTContextKey holds the key used to store a JWT in the - // context. - JWTContextKey contextKey = "JWT" + // JWTContextKey holds the key used to store a JWT in the context. + JWTContextKey contextKey = "JWTToken" + + // JWTTokenContextKey is an alias for JWTContextKey. + // + // Deprecated: only exists for historical compatibility. + // JWTContextKey would be preferable. + JWTTokenContextKey = JWTContextKey // JWTClaimsContextKey holds the key used to store the JWT Claims in the // context.