authtest

package
v0.0.0-...-fb7f86c Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2023 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeOAuthTokenService

type FakeOAuthTokenService struct {
	ExpectedAuthUser *login.UserAuth
	ExpectedErrors   map[string]error
	// contains filtered or unexported fields
}

func (*FakeOAuthTokenService) GetCurrentOAuthToken

func (ts *FakeOAuthTokenService) GetCurrentOAuthToken(context.Context, *user.SignedInUser) *oauth2.Token

func (*FakeOAuthTokenService) HasOAuthEntry

func (*FakeOAuthTokenService) InvalidateOAuthTokens

func (ts *FakeOAuthTokenService) InvalidateOAuthTokens(ctx context.Context, usr *login.UserAuth) error

func (*FakeOAuthTokenService) IsOAuthPassThruEnabled

func (ts *FakeOAuthTokenService) IsOAuthPassThruEnabled(*datasources.DataSource) bool

func (*FakeOAuthTokenService) TryTokenRefresh

func (ts *FakeOAuthTokenService) TryTokenRefresh(ctx context.Context, usr *login.UserAuth) error

type FakeUserAuthTokenService

type FakeUserAuthTokenService struct {
	CreateTokenProvider          func(ctx context.Context, user *user.User, clientIP net.IP, userAgent string) (*auth.UserToken, error)
	RotateTokenProvider          func(ctx context.Context, cmd auth.RotateCommand) (*auth.UserToken, error)
	TryRotateTokenProvider       func(ctx context.Context, token *auth.UserToken, clientIP net.IP, userAgent string) (bool, *auth.UserToken, error)
	LookupTokenProvider          func(ctx context.Context, unhashedToken string) (*auth.UserToken, error)
	RevokeTokenProvider          func(ctx context.Context, token *auth.UserToken, soft bool) error
	RevokeAllUserTokensProvider  func(ctx context.Context, userId int64) error
	ActiveAuthTokenCount         func(ctx context.Context) (int64, error)
	GetUserTokenProvider         func(ctx context.Context, userId, userTokenId int64) (*auth.UserToken, error)
	GetUserTokensProvider        func(ctx context.Context, userId int64) ([]*auth.UserToken, error)
	GetUserRevokedTokensProvider func(ctx context.Context, userId int64) ([]*auth.UserToken, error)
	BatchRevokedTokenProvider    func(ctx context.Context, userIds []int64) error
}

func NewFakeUserAuthTokenService

func NewFakeUserAuthTokenService() *FakeUserAuthTokenService

func (*FakeUserAuthTokenService) ActiveTokenCount

func (s *FakeUserAuthTokenService) ActiveTokenCount(ctx context.Context) (int64, error)

func (*FakeUserAuthTokenService) BatchRevokeAllUserTokens

func (s *FakeUserAuthTokenService) BatchRevokeAllUserTokens(ctx context.Context, userIds []int64) error

func (*FakeUserAuthTokenService) CreateToken

func (s *FakeUserAuthTokenService) CreateToken(ctx context.Context, user *user.User, clientIP net.IP, userAgent string) (*auth.UserToken, error)

func (*FakeUserAuthTokenService) GetUserRevokedTokens

func (s *FakeUserAuthTokenService) GetUserRevokedTokens(ctx context.Context, userId int64) ([]*auth.UserToken, error)

func (*FakeUserAuthTokenService) GetUserToken

func (s *FakeUserAuthTokenService) GetUserToken(ctx context.Context, userId, userTokenId int64) (*auth.UserToken, error)

func (*FakeUserAuthTokenService) GetUserTokens

func (s *FakeUserAuthTokenService) GetUserTokens(ctx context.Context, userId int64) ([]*auth.UserToken, error)

func (*FakeUserAuthTokenService) Init

func (s *FakeUserAuthTokenService) Init() error

Init initializes the service. Required for dependency injection.

func (*FakeUserAuthTokenService) LookupToken

func (s *FakeUserAuthTokenService) LookupToken(ctx context.Context, unhashedToken string) (*auth.UserToken, error)

func (*FakeUserAuthTokenService) RevokeAllUserTokens

func (s *FakeUserAuthTokenService) RevokeAllUserTokens(ctx context.Context, userId int64) error

func (*FakeUserAuthTokenService) RevokeToken

func (s *FakeUserAuthTokenService) RevokeToken(ctx context.Context, token *auth.UserToken, soft bool) error

func (*FakeUserAuthTokenService) RotateToken

func (*FakeUserAuthTokenService) TryRotateToken

func (s *FakeUserAuthTokenService) TryRotateToken(ctx context.Context, token *auth.UserToken, clientIP net.IP,
	userAgent string) (bool, *auth.UserToken, error)

Jump to

Keyboard shortcuts

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