mock

package
v1.0.0-13 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrGeneric used for testing purposes
	ErrGeneric = errors.New("generic error used for testing purposes")
)

Functions

This section is empty.

Types

type Auth

type Auth struct {
	GetUserFn func(context.Context) *model.AuthUser
}

Auth mock

func (*Auth) GetUser

func (s *Auth) GetUser(c context.Context) *model.AuthUser

GetUser mock

type JWT

type JWT struct {
	GenerateTokenFn func(*model.AuthUser) (string, error)
}

JWT mock

func (*JWT) GenerateToken

func (j *JWT) GenerateToken(u *model.AuthUser) (string, error)

GenerateToken mock

type RBAC

type RBAC struct {
	EnforceRoleFn          func(context.Context, model.AccessRole) bool
	EnforceUserFn          func(context.Context, int64) bool
	EnforceTenantFn        func(context.Context, int32) bool
	EnforceTenantAdminFn   func(context.Context, int32) bool
	IsLowerRoleFn          func(context.Context, model.AccessRole) bool
	EnforceTenantAndRoleFn func(context.Context, model.AccessRole, int32) bool
}

RBAC Mock

func (*RBAC) EnforceRole

func (a *RBAC) EnforceRole(c context.Context, role model.AccessRole) bool

EnforceRole mock

func (*RBAC) EnforceTenant

func (a *RBAC) EnforceTenant(c context.Context, id int32) bool

EnforceTenant mock

func (*RBAC) EnforceTenantAdmin

func (a *RBAC) EnforceTenantAdmin(c context.Context, id int32) bool

EnforceTenantAdmin mock

func (*RBAC) EnforceTenantAndRole

func (a *RBAC) EnforceTenantAndRole(c context.Context, role model.AccessRole, id int32) bool

EnforceTenantAndRole mock

func (*RBAC) EnforceUser

func (a *RBAC) EnforceUser(c context.Context, id int64) bool

EnforceUser mock

func (*RBAC) IsLowerRole

func (a *RBAC) IsLowerRole(c context.Context, role model.AccessRole) bool

IsLowerRole mock

type Secure

type Secure struct {
	PasswordFn    func(string, ...string) bool
	HashFn        func(string) string
	MatchesHashFn func(string, string) bool
}

Secure mock

func (*Secure) Hash

func (s *Secure) Hash(str string) string

Hash mock

func (*Secure) MatchesHash

func (s *Secure) MatchesHash(hash, pw string) bool

MatchesHash mock

func (*Secure) Password

func (s *Secure) Password(pw string, inputs ...string) bool

Password mock

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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