MCPcopy Create free account
hub / github.com/prometheus/common / JwtGrantTypeConfig

Struct JwtGrantTypeConfig

config/oauth_assertion.go:39–84  ·  view source on GitHub ↗

Config is the configuration for using JWT to fetch tokens, commonly known as "two-legged OAuth 2.0".

Source from the content-addressed store, hash-verified

37// Config is the configuration for using JWT to fetch tokens,
38// commonly known as "two-legged OAuth 2.0".
39type JwtGrantTypeConfig struct {
40 // Iss is the OAuth client identifier used when communicating with
41 // the configured OAuth provider.
42 Iss string
43
44 // PrivateKey contains the contents of an RSA private key or the
45 // contents of a PEM file that contains a private key. The provided
46 // private key is used to sign JWT payloads.
47 // PEM containers with a passphrase are not supported.
48 // Use the following command to convert a PKCS 12 file into a PEM.
49 //
50 // $ openssl pkcs12 -in key.p12 -out key.pem -nodes
51 //
52 PrivateKey []byte
53
54 // SigningAlgorithm is the RSA algorithm used to sign JWT payloads
55 SigningAlgorithm *jwt.SigningMethodRSA
56
57 // PrivateKeyID contains an optional hint indicating which key is being
58 // used.
59 PrivateKeyID string
60
61 // Subject is the optional user to impersonate.
62 Subject string
63
64 // Scopes optionally specifies a list of requested permission scopes.
65 Scopes []string
66
67 // TokenURL is the endpoint required to complete the 2-legged JWT flow.
68 TokenURL string
69
70 // EndpointParams specifies additional parameters for requests to the token endpoint.
71 EndpointParams url.Values
72
73 // Expires optionally specifies how long the token is valid for.
74 Expires time.Duration
75
76 // Audience optionally specifies the intended audience of the
77 // request. If empty, the value of TokenURL is used as the
78 // intended audience.
79 Audience string
80
81 // PrivateClaims optionally specifies custom private claims in the JWT.
82 // See http://tools.ietf.org/html/draft-jones-json-web-token-10#section-4.3
83 PrivateClaims map[string]any
84}
85
86// TokenSource returns a JWT TokenSource using the configuration
87// in c and the HTTP client from the provided context.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected