Documentation
¶
Overview ¶
Package pkce implements the in-memory store of PKCE challenges that link a /authorize redirect to its later /oauth/token exchange.
Auth0 (and OAuth 2.1 generally) requires SPAs and native clients to send a code_challenge + code_challenge_method on /authorize and the matching code_verifier on /oauth/token. The server stores the challenge keyed by the generated code; when the client exchanges that code it must present a verifier that hashes back to the stored challenge.
Index ¶
Constants ¶
const DefaultTTL = 10 * time.Minute
DefaultTTL is how long a stored challenge is valid before the matching code becomes unredeemable.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Entry ¶
type Entry struct {
Challenge string
Method Method
ClientID string
Redirect string
// contains filtered or unexported fields
}
Entry is the data stashed at /authorize and consulted at /oauth/token.
type Method ¶
type Method string
Method is the code_challenge_method value the client used at /authorize.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store maps the random code returned by /authorize to its PKCE Entry. Entries expire after DefaultTTL. Safe for concurrent use.
func (*Store) Consume ¶
Consume returns the Entry registered against code and removes it. Returns false if the code is unknown or its entry has expired.