auth

package
v3.0.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const UPLOAD_USER_EMAIL = "upload"

Variables

This section is empty.

Functions

func FakeOauthConfig

func FakeOauthConfig() *oauth2.Config

Types

type Authenticator

type Authenticator interface {
	// AuthenticateRequest takes an HTTP request and
	// attempts to authenticate it.
	// It returns the email address of the authenticated
	// user, or an error.
	// TODO: maybe this should be Authenticate(string) (string, error)
	// Taking the Authorization header and returning the email address
	AuthenticateRequest(*http.Request) (string, error)
}

type FakeAuthenticator

type FakeAuthenticator struct {
	MockAuthenticateRequest func(r *http.Request) (string, error)
}

func (FakeAuthenticator) AuthenticateRequest

func (f FakeAuthenticator) AuthenticateRequest(r *http.Request) (string, error)

type FakeOAuthClient

type FakeOAuthClient struct {
	MockAuthCodeURL func(string, ...oauth2.AuthCodeOption) string
	MockExchange    func(context.Context, string) (*oauth2.Token, error)
}

func (*FakeOAuthClient) AuthCodeURL

func (c *FakeOAuthClient) AuthCodeURL(state string, opts ...oauth2.AuthCodeOption) string

func (*FakeOAuthClient) Exchange

func (c *FakeOAuthClient) Exchange(ctx context.Context, code string) (*oauth2.Token, error)

type GoogleAuthenticator

type GoogleAuthenticator struct {
	OAuthClient            OAuthClient
	SharedSecret           string
	TrustedUserEmailDomain string
}

func (GoogleAuthenticator) AuthenticateRequest

func (g GoogleAuthenticator) AuthenticateRequest(r *http.Request) (string, error)

type GoogleOAuthClient

type GoogleOAuthClient struct {
	Config *oauth2.Config
}

func (GoogleOAuthClient) LookupAccessToken

func (g GoogleOAuthClient) LookupAccessToken(refreshToken string) (string, error)

type IntegrationTestOAuthClient

type IntegrationTestOAuthClient struct{}

IntegrationTestOAuthClient is used for integration tests

func (IntegrationTestOAuthClient) LookupAccessToken

func (f IntegrationTestOAuthClient) LookupAccessToken(accessToken string) (string, error)

type OAuthClient

type OAuthClient interface {
	// LookupAccessToken takes an access token
	// and returns the email address associated
	// with it
	LookupAccessToken(string) (string, error)
}

Jump to

Keyboard shortcuts

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