Documentation
¶
Overview ¶
Package authtest implements authentication related test helpers.
Index ¶
Constants ¶
View Source
const ( DefaultFakeEmail = "fake_test@example.com" DefaultFakeToken = "fake_test_token" DefaultFakeLifetime = 5 * time.Minute )
Defaults for FakeTokenGenerator.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FakeTokenGenerator ¶
type FakeTokenGenerator struct { Email string // email of the default account (default "fake_test@example.com") Token string // access token to return (default "fake_test_token") Lifetime time.Duration // lifetime of the returned token (default 5 min) }
FakeTokenGenerator implements localauth.TokenGenerator by returning fake data.
Useful for integration tests that involve local auth server.
func (*FakeTokenGenerator) GenerateToken ¶
func (f *FakeTokenGenerator) GenerateToken(ctx context.Context, scopes []string, lifetime time.Duration) (*oauth2.Token, error)
GenerateToken is part of TokenGenerator interface.
func (*FakeTokenGenerator) GetEmail ¶
func (f *FakeTokenGenerator) GetEmail() (string, error)
GetEmail is part of TokenGenerator interface.
Click to show internal directories.
Click to hide internal directories.