Skip to content

Commit 38b38eb

Browse files
committed
comments
1 parent 47e512d commit 38b38eb

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

jwt.go

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -47,28 +47,28 @@ type Config struct {
4747

4848
// JWTPlugin is a traefik middleware plugin that authorizes access based on JWT tokens.
4949
type JWTPlugin struct {
50-
next http.Handler
51-
name string
52-
parser *jwt.Parser
53-
secret any
54-
issuers []string
55-
clients map[string]*http.Client
56-
defaultClient *http.Client
57-
require map[string][]Requirement
58-
lock sync.RWMutex
59-
keys map[string]any
60-
issuerKeys map[string]map[string]any
61-
optional bool
62-
redirectUnauthorized *template.Template
63-
redirectForbidden *template.Template
64-
cookieName string
65-
headerName string
66-
parameterName string
67-
headerMap map[string]string
68-
forwardToken bool
69-
freshness int64
70-
environment map[string]string
71-
infoToStdout bool
50+
next http.Handler // The next http.Handler in the chain
51+
name string // The name of the plugin
52+
parser *jwt.Parser // A JWT parser instance, which we use for all token parsing
53+
secret any // A single anonymous fixed public key or HMAC secret, or nil
54+
issuers []string // A list of valid issuers that we trust to fetch keys from
55+
clients map[string]*http.Client // A map of clients for specific issuers that skip certificate verification
56+
defaultClient *http.Client // A default client for fetching keys with certificate verification, optionally with custom root CAs
57+
require map[string][]Requirement // A map of requirements for each claim
58+
lock sync.RWMutex // Read-write lock for the keys and issuerKeys maps
59+
keys map[string]any // A map of key IDs to public keys or shared HMAC secrets
60+
issuerKeys map[string]map[string]any // A map of issuer URLs to key IDs to public keys, for reference counting / purging
61+
optional bool // If true, requests without a token are allowed but any token provided must still be valid
62+
redirectUnauthorized *template.Template // A template for redirecting unauthorized requests
63+
redirectForbidden *template.Template // A template for redirecting forbidden requests
64+
cookieName string // The name of the cookie to extract the token from
65+
headerName string // The name of the header to extract the token from
66+
parameterName string // The name of the query parameter to extract the token from
67+
headerMap map[string]string // A map of claim names to header names to forward to the backend
68+
forwardToken bool // If true, the token is forwarded to the backend
69+
freshness int64 // The maximum age of a token in seconds
70+
environment map[string]string // Map of environment variables
71+
infoToStdout bool // If true, log non-error messahes to stdout instead of the default logger
7272
}
7373

7474
// TemplateVariables are the per-request variables passed to Go templates for interpolation, such as the require and redirect templates.

0 commit comments

Comments
 (0)