authservice

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const TraceIdHeader = "X-Request-Id" // repeat for circular ref avoidance

Variables

View Source
var (
	UnauthorizedError = errors.New("got unauthorized from userinfo endpoint")
	DownstreamError   = errors.New("downstream unavailable - see log for details")
)

Functions

This section is empty.

Types

type AuthService

type AuthService interface {
	IsEnabled() bool

	UserInfo(ctx context.Context) (UserInfoResponse, error)
}

func Get

func Get() AuthService

func New

func New() (AuthService, error)

type Impl

type Impl struct {
	// contains filtered or unexported fields
}

func (Impl) IsEnabled

func (i Impl) IsEnabled() bool

func (Impl) UserInfo

func (i Impl) UserInfo(ctx context.Context) (UserInfoResponse, error)

type Mock

type Mock interface {
	AuthService

	Reset()
	Enable()
	Recording() []string
	SimulateGetError(err error)
	SetupResponse(idToken string, acToken string, response UserInfoResponse)
}

func CreateMock

func CreateMock() Mock

type MockImpl

type MockImpl struct {
	// contains filtered or unexported fields
}

func (*MockImpl) Enable

func (m *MockImpl) Enable()

func (*MockImpl) IsEnabled

func (m *MockImpl) IsEnabled() bool

func (*MockImpl) Recording

func (m *MockImpl) Recording() []string

func (*MockImpl) Reset

func (m *MockImpl) Reset()

func (*MockImpl) SetupResponse

func (m *MockImpl) SetupResponse(idToken string, acToken string, response UserInfoResponse)

func (*MockImpl) SimulateGetError

func (m *MockImpl) SimulateGetError(err error)

func (*MockImpl) UserInfo

func (m *MockImpl) UserInfo(ctx context.Context) (UserInfoResponse, error)

type UserInfoResponse

type UserInfoResponse struct {
	Audiences     []string `json:"audiences"`
	Subject       string   `json:"subject"`
	Name          string   `json:"name"`
	Email         string   `json:"email"`
	EmailVerified bool     `json:"email_verified"`
	Groups        []string `json:"groups"`
}

Jump to

Keyboard shortcuts

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