luci: go.chromium.org/luci/auth/integration/authtest Index | Files

package authtest

import "go.chromium.org/luci/auth/integration/authtest"

Package authtest implements authentication related test helpers.

Index

Package Files

doc.go faketokengen.go

Constants

const (
    DefaultFakeEmail    = "fake_test@example.com"
    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 "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 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 2018-10-21. Refresh now. Tools for package owners.