Skip to content

Commit 5362057

Browse files
committed
refactor(middleware): unexport the signatureAlgorithms variable
1 parent 98fb888 commit 5362057

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

middleware/token.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,22 @@ import (
1212

1313
const tokenAuthPrefix = "BEARER"
1414

15-
var SignatureAlgorithms = []jose.SignatureAlgorithm{jose.RS256}
15+
var signatureAlgorithms = []jose.SignatureAlgorithm{jose.RS256}
1616

1717
// StoreWebToken returns middleware that extracts a JWT from the HTTP `Authorization` header
1818
// and stores it in the request pmcontext for downstream handlers.
1919
//
2020
// The middleware looks for an Authorization header of the form `Bearer <token>` (scheme match is
2121
// case-insensitive). When present, the token is added to the pmcontext via
22-
// context.AddWebTokenToContext using the package's SignatureAlgorithms. If the header is absent,
22+
// context.AddWebTokenToContext using the package's signatureAlgorithms. If the header is absent,
2323
// malformed, or not a Bearer token, the request pmcontext is left unchanged.
2424
func StoreWebToken() func(http.Handler) http.Handler {
2525
return func(next http.Handler) http.Handler {
2626
return http.HandlerFunc(func(responseWriter http.ResponseWriter, request *http.Request) {
2727
ctx := request.Context()
2828
auth := strings.Split(request.Header.Get(headers.Authorization), " ")
2929
if len(auth) > 1 && strings.ToUpper(auth[0]) == tokenAuthPrefix {
30-
ctx = pmcontext.AddWebTokenToContext(ctx, auth[1], SignatureAlgorithms)
30+
ctx = pmcontext.AddWebTokenToContext(ctx, auth[1], signatureAlgorithms)
3131
}
3232

3333
next.ServeHTTP(responseWriter, request.WithContext(ctx))

0 commit comments

Comments
 (0)