authtest

package
v0.0.0-...-d60a78d Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

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.

Jump to

Keyboard shortcuts

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