twolegged

package
v0.0.0-...-4946764 Latest Latest
Warning

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

Go to latest
Published: May 19, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	oauth.AuthData
	// UserID is the user to act on the behalf of.
	UserID string
	// contains filtered or unexported fields
}

Auth struct holds data necessary for making requests in 2-legged context

func NewAuth

func NewAuth(clientID, clientSecret string) Auth

NewClient returns a 2-legged authenticator with default host and authPath

func (Auth) Authenticate

func (a Auth) Authenticate(scope scopes.Scope) (bearer *oauth.Bearer, err error)

Authenticate allows getting a token with a given scope

func (Auth) GetTokenWithScope

func (a Auth) GetTokenWithScope(scope scopes.Scope) (*oauth.Bearer, error)

GetTokenWithScope will get the a token for the given scope

func (Auth) SetAuthHeader

func (a Auth) SetAuthHeader(scope scopes.Scope, header http.Header) error

type Authenticator

type Authenticator interface {
	Authenticate(scope scopes.Scope) (*oauth.Bearer, error)
}

Authenticator interface defines the method necessary to qualify as 2-legged authenticator

Jump to

Keyboard shortcuts

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