luci: Index | Files

package authtest

import ""

Package authtest implements authentication related test helpers.


Package Files

doc.go faketokengen.go


const (
    DefaultFakeEmail    = ""
    DefaultFakeToken    = "fake_test_token"
    DefaultFakeLifetime = 5 * time.Minute

Defaults for FakeTokenGenerator.

type FakeTokenGenerator Uses

type FakeTokenGenerator struct {
    Email    string        // email of the default account (default "")
    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 Uses

func (f *FakeTokenGenerator) GenerateToken(ctx context.Context, scopes []string, lifetime time.Duration) (*oauth2.Token, error)

GenerateToken is part of TokenGenerator interface.

func (*FakeTokenGenerator) GetEmail Uses

func (f *FakeTokenGenerator) GetEmail() (string, error)

GetEmail is part of TokenGenerator interface.

Package authtest imports 4 packages (graph). Updated 2019-04-19. Refresh now. Tools for package owners.