mock

package
v0.0.0-...-faa3d42 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2020 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) *easypay.AuthUser
}

Auth mock

func (*Auth) GetUser

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

GetUser mock

type JWT

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

JWT mock

func (*JWT) GenerateToken

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

GenerateToken mock

type RBAC

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

RBAC Mock

func (*RBAC) EnforceRole

func (a *RBAC) EnforceRole(c context.Context, role easypay.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 easypay.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 easypay.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