Documentation ¶
Overview ¶
Package PKCE implements Proof Key for Code Exchange by OAuth Public Clients.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Challenge ¶
type Challenge [43]byte
Challenge is a 43-octet URL safe PKCE Code Challenge.
Use `String()` to get a string representation of `Challenge` or `AuthCodeOption()` to get an option compatible with `golang.org/x/oauth2.Config.Exchange()`.
func ChallengeFromString ¶
ChallengeFromString returns a `Challenge` from its string representation.
func (Challenge) AuthCodeOption ¶
func (c Challenge) AuthCodeOption() oauth2.AuthCodeOption
AuthCodeOption returns an option compatible with `golang.org/x/oauth2.Config.Exchange()`.
type Method ¶
type Method uint8
Method used to create the PKCE Code Challenge.
Available methods for creating the PKCE Code Challenge.
If the client is capable of using MethodS256, it MUST use MethodS256, as MethodS256 is Mandatory To Implement (MTI) on the server. Clients are permitted to use MethodPlain only if they cannot support MethodS256 for some technical reason and know via out-of-band configuration that the server supports MethodPlain.
The plain transformation is for compatibility with existing deployments and for constrained environments that can't use the S256 transformation.
See also: https://datatracker.ietf.org/doc/html/rfc7636#section-4.2.
func MethodFromString ¶
MethodFromString returns a `Method` from its string representation.
func (Method) AuthCodeOption ¶
func (m Method) AuthCodeOption() oauth2.AuthCodeOption
AuthCodeOption returns an option compatible with `golang.org/x/oauth2.Config.Exchange()`.
type Verifier ¶
type Verifier [43]byte
Verifier is a 43-octet URL safe PKCE Code Verifier.
Use `String()` to get a string representation of `Verifier` or `AuthCodeOption()` to get an option compatible with `golang.org/x/oauth2.Config.AuthCodeURL()`.
func VerifierFromString ¶
VerifierFromString returns a `Verifier` from its string representation.
func (Verifier) AuthCodeOption ¶
func (v Verifier) AuthCodeOption() oauth2.AuthCodeOption
AuthCodeOption returns an option compatible with `golang.org/x/oauth2.Config.AuthCodeURL()`.
func (Verifier) Challenge ¶
Challenge creates the PKCE Code Challenge for the PKCE Code Verifier using the given `Method`.
If the client is capable of using MethodS256, it MUST use MethodS256, as MethodS256 is Mandatory To Implement (MTI) on the server. Clients are permitted to use MethodPlain only if they cannot support MethodS256 for some technical reason and know via out-of-band configuration that the server supports MethodPlain.
The plain transformation is for compatibility with existing deployments and for constrained environments that can't use the S256 transformation.
See also: https://datatracker.ietf.org/doc/html/rfc7636#section-4.2.