Documentation ¶
Index ¶
Constants ¶
View Source
const UPLOAD_USER_EMAIL = "upload"
Variables ¶
This section is empty.
Functions ¶
func FakeOauthConfig ¶
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, string, error) IsRefreshTokenValid(string) (bool, error, error) }
type FakeAuthenticator ¶
type FakeAuthenticator struct { MockAuthenticateRequest func(r *http.Request) (string, string, error) MockIsRefreshTokenValid func(string) (bool, error, error) }
func (FakeAuthenticator) AuthenticateRequest ¶
func (FakeAuthenticator) IsRefreshTokenValid ¶
func (f FakeAuthenticator) IsRefreshTokenValid(refreshToken string) (bool, error, 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
type GoogleAuthenticator ¶
type GoogleAuthenticator struct { OAuthClient OAuthClient TrustedUserEmailDomain string }
func (GoogleAuthenticator) AuthenticateRequest ¶
func (GoogleAuthenticator) IsRefreshTokenValid ¶
func (g GoogleAuthenticator) IsRefreshTokenValid(refreshToken string) (bool, error, error)
IsRefreshTokenValid checks if a refresh token is valid by requesting a new access token with it. The first return parameter will return true only if the token is currently valid, i.e. the user has not been suspended or revoked their token. The second return parameter is an error that is populated only if there has been an error when attempting to determine if the token is valid. The third return parameter is an error that is populated only if the token is not currently valid, so can be used to determine the reason for its invalidity.
type GoogleOAuthClient ¶
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(refreshToken string) (string, error)
type OAuthClient ¶
Click to show internal directories.
Click to hide internal directories.