auth

package
v0.0.0-...-e83cbdc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 6, 2020 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrStateMismatch is returned with invalid state is received.
	ErrStateMismatch = errors.New("auth: state mismatch")
)

Functions

func NewClientCredentialsSource

func NewClientCredentialsSource(ctx context.Context, oc *clientcredentials.Config) oauth2.TokenSource

NewClientCredentialsSource returns a token source that uses the supplied client credentials.

This source uses the OAuth 2.0 Client Credentials flow.

func NewInteractiveTokenSource

func NewInteractiveTokenSource(ctx context.Context, rs rand.Source, bo BrowserOpener, oc *oauth2.Config) oauth2.TokenSource

NewInteractiveTokenSource returns a token source that allows a user to interactively log in.

This source uses the OAuth 2.0 Authorization Code with Proof Key Code Exchange flow.

Types

type BrowserOpener

type BrowserOpener interface {
	Open(url string) error
}

BrowserOpener describes the interface to open an URL in a browser.

type CodeVerifier

type CodeVerifier struct {
	// contains filtered or unexported fields
}

CodeVerifier represents a code verifier used to implement the Proof Key for Code Exchange by OAuth Public Clients specification (RFC 7636).

func NewCodeVerifier

func NewCodeVerifier(s rand.Source) (*CodeVerifier, error)

NewCodeVerifier creates a new CodeVerifier as per the Proof Key for Code Exchange by OAuth Public Clients specification (RFC 7636).

Use String() to obtain the code verifier, and Challenge() to obtain the code challenge.

func (*CodeVerifier) Challenge

func (cv *CodeVerifier) Challenge() string

Challenge returns the code challenge as described in RFC 7636 § 4.2.

func (*CodeVerifier) ChallengeMethod

func (cv *CodeVerifier) ChallengeMethod() string

ChallengeMethod returns the method used to encode the code challenge.

func (*CodeVerifier) String

func (cv *CodeVerifier) String() string

String returns the code verifier as described in RFC 7636 § 4.1.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL