app

package
v0.0.0-...-1e118f8 Latest Latest
Warning

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

Go to latest
Published: May 30, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package app is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrorUserAlreadyExists .
	ErrorUserAlreadyExists = errors.New("user already exists")

	// ErrorInvalidJwtToken .
	ErrorInvalidJwtToken = errors.New("invalid jwt token")

	// ErrorNotFound .
	ErrorNotFound = errors.New("not found")

	// ErrorUserIsNotActive .
	ErrorUserIsNotActive = errors.New("user is not active")

	// ErrorUserIsActive .
	ErrorUserIsActive = errors.New("user is active")

	// ErrorInternalStorageInconsistent .
	ErrorInternalStorageInconsistent = errors.New("internal storage inconsistent")

	// ErrorPasswordIsVeryBasic .
	ErrorPasswordIsVeryBasic = errors.New("password is very basic")

	// ErrorPasswordMismatch .
	ErrorPasswordMismatch = errors.New("password mismatch")
)

Functions

This section is empty.

Types

type AuthModuleDependencyType

type AuthModuleDependencyType int

AuthModuleDependencyType .

const (
	// UserRepositoryServiceSymbol .
	UserRepositoryServiceSymbol AuthModuleDependencyType = iota
	// JwtRepositoryServiceSymbol .
	JwtRepositoryServiceSymbol
	// PasswordServiceSymbol .
	PasswordServiceSymbol
	// JwtServiceSymbol .
	JwtServiceSymbol

	// UserAppSymbol .
	UserAppSymbol
	// JwtAppSymbol .
	JwtAppSymbol

	// DomainEventsSymbol .
	DomainEventsSymbol
)

type DomainEvents

type DomainEvents interface {
	UserCreated() subscribs.EventHandler
	UserStatusChanged() subscribs.EventHandler
	UserResetPassword() subscribs.EventHandler
	UserPasswordChanged() subscribs.EventHandler
}

DomainEvents .

type Jwt

type Jwt struct {
	TenantID TenantID `json:"-"`
	JwtDecoded

	SessionID string `json:"session,omitempty"`
	ExpiredAt int    `json:"expired,omitempty"`
}

Jwt .

type JwtApp

type JwtApp interface {
	GetAllByUserID(tenantID TenantID, userID UserID) ([]JwtEncoded, error)
	Create(tenantID TenantID, login, password string, request *JwtAppCreateRequest) (JwtEncoded, error)
	Validate(tenantID TenantID, token JwtEncoded) (*JwtDecoded, error)
	Invalidate(tenantID TenantID, token JwtEncoded) error
	InvalidateAllTokens(tenantID TenantID, userID UserID) error
}

JwtApp .

type JwtAppCreateRequest

type JwtAppCreateRequest struct {
	Scope string
	TTL   int
	Attrs map[string]string
}

JwtAppCreateRequest .

type JwtAttrs

type JwtAttrs = map[string]interface{}

JwtAttrs .

type JwtDecoded

type JwtDecoded struct {
	ID     JwtID             `json:"id"`
	UserID UserID            `json:"user"`
	Scope  string            `json:"scope,omitempty"`
	Iat    int               `json:"iat"`
	Attrs  map[string]string `json:"attrs,omitempty"`
}

JwtDecoded .

type JwtEncoded

type JwtEncoded = string

JwtEncoded .

type JwtID

type JwtID = string

JwtID .

type JwtRepositoryService

type JwtRepositoryService interface {
	GetAll(tenantID TenantID, userID UserID) ([]Jwt, error)
	GetByIDs(tenantID TenantID, userID UserID, tokenID JwtID) (*Jwt, error)

	Save(token *Jwt) (*Jwt, error)

	RemoveAll(tenantID TenantID, userID UserID) error
	Remove(token *Jwt) error
}

JwtRepositoryService .

type JwtService

type JwtService interface {
	SignAndEncode(attrs JwtAttrs) (string, error)
	VerifyAndDecode(tokenString string) (JwtAttrs, error)
}

JwtService .

type MockDomainEvents

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

MockDomainEvents is a mock of DomainEvents interface

func NewMockDomainEvents

func NewMockDomainEvents(ctrl *gomock.Controller) *MockDomainEvents

NewMockDomainEvents creates a new mock instance

func (*MockDomainEvents) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockDomainEvents) UserCreated

func (m *MockDomainEvents) UserCreated() subscribs.EventHandler

UserCreated mocks base method

func (*MockDomainEvents) UserPasswordChanged

func (m *MockDomainEvents) UserPasswordChanged() subscribs.EventHandler

UserPasswordChanged mocks base method

func (*MockDomainEvents) UserResetPassword

func (m *MockDomainEvents) UserResetPassword() subscribs.EventHandler

UserResetPassword mocks base method

func (*MockDomainEvents) UserStatusChanged

func (m *MockDomainEvents) UserStatusChanged() subscribs.EventHandler

UserStatusChanged mocks base method

type MockDomainEventsMockRecorder

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

MockDomainEventsMockRecorder is the mock recorder for MockDomainEvents

func (*MockDomainEventsMockRecorder) UserCreated

func (mr *MockDomainEventsMockRecorder) UserCreated() *gomock.Call

UserCreated indicates an expected call of UserCreated

func (*MockDomainEventsMockRecorder) UserPasswordChanged

func (mr *MockDomainEventsMockRecorder) UserPasswordChanged() *gomock.Call

UserPasswordChanged indicates an expected call of UserPasswordChanged

func (*MockDomainEventsMockRecorder) UserResetPassword

func (mr *MockDomainEventsMockRecorder) UserResetPassword() *gomock.Call

UserResetPassword indicates an expected call of UserResetPassword

func (*MockDomainEventsMockRecorder) UserStatusChanged

func (mr *MockDomainEventsMockRecorder) UserStatusChanged() *gomock.Call

UserStatusChanged indicates an expected call of UserStatusChanged

type MockJwtApp

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

MockJwtApp is a mock of JwtApp interface

func NewMockJwtApp

func NewMockJwtApp(ctrl *gomock.Controller) *MockJwtApp

NewMockJwtApp creates a new mock instance

func (*MockJwtApp) Create

func (m *MockJwtApp) Create(tenantID TenantID, login, password string, request *JwtAppCreateRequest) (JwtEncoded, error)

Create mocks base method

func (*MockJwtApp) EXPECT

func (m *MockJwtApp) EXPECT() *MockJwtAppMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

func (*MockJwtApp) GetAllByUserID

func (m *MockJwtApp) GetAllByUserID(tenantID TenantID, userID UserID) ([]JwtEncoded, error)

GetAllByUserID mocks base method

func (*MockJwtApp) Invalidate

func (m *MockJwtApp) Invalidate(tenantID TenantID, token JwtEncoded) error

Invalidate mocks base method

func (*MockJwtApp) InvalidateAllTokens

func (m *MockJwtApp) InvalidateAllTokens(tenantID TenantID, userID UserID) error

InvalidateAllTokens mocks base method

func (*MockJwtApp) Validate

func (m *MockJwtApp) Validate(tenantID TenantID, token JwtEncoded) (*JwtDecoded, error)

Validate mocks base method

type MockJwtAppMockRecorder

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

MockJwtAppMockRecorder is the mock recorder for MockJwtApp

func (*MockJwtAppMockRecorder) Create

func (mr *MockJwtAppMockRecorder) Create(tenantID, login, password, request interface{}) *gomock.Call

Create indicates an expected call of Create

func (*MockJwtAppMockRecorder) GetAllByUserID

func (mr *MockJwtAppMockRecorder) GetAllByUserID(tenantID, userID interface{}) *gomock.Call

GetAllByUserID indicates an expected call of GetAllByUserID

func (*MockJwtAppMockRecorder) Invalidate

func (mr *MockJwtAppMockRecorder) Invalidate(tenantID, token interface{}) *gomock.Call

Invalidate indicates an expected call of Invalidate

func (*MockJwtAppMockRecorder) InvalidateAllTokens

func (mr *MockJwtAppMockRecorder) InvalidateAllTokens(tenantID, userID interface{}) *gomock.Call

InvalidateAllTokens indicates an expected call of InvalidateAllTokens

func (*MockJwtAppMockRecorder) Validate

func (mr *MockJwtAppMockRecorder) Validate(tenantID, token interface{}) *gomock.Call

Validate indicates an expected call of Validate

type MockJwtRepositoryService

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

MockJwtRepositoryService is a mock of JwtRepositoryService interface

func NewMockJwtRepositoryService

func NewMockJwtRepositoryService(ctrl *gomock.Controller) *MockJwtRepositoryService

NewMockJwtRepositoryService creates a new mock instance

func (*MockJwtRepositoryService) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockJwtRepositoryService) GetAll

func (m *MockJwtRepositoryService) GetAll(tenantID TenantID, userID UserID) ([]Jwt, error)

GetAll mocks base method

func (*MockJwtRepositoryService) GetByIDs

func (m *MockJwtRepositoryService) GetByIDs(tenantID TenantID, userID UserID, tokenID JwtID) (*Jwt, error)

GetByIDs mocks base method

func (*MockJwtRepositoryService) Remove

func (m *MockJwtRepositoryService) Remove(token *Jwt) error

Remove mocks base method

func (*MockJwtRepositoryService) RemoveAll

func (m *MockJwtRepositoryService) RemoveAll(tenantID TenantID, userID UserID) error

RemoveAll mocks base method

func (*MockJwtRepositoryService) Save

func (m *MockJwtRepositoryService) Save(token *Jwt) (*Jwt, error)

Save mocks base method

type MockJwtRepositoryServiceMockRecorder

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

MockJwtRepositoryServiceMockRecorder is the mock recorder for MockJwtRepositoryService

func (*MockJwtRepositoryServiceMockRecorder) GetAll

func (mr *MockJwtRepositoryServiceMockRecorder) GetAll(tenantID, userID interface{}) *gomock.Call

GetAll indicates an expected call of GetAll

func (*MockJwtRepositoryServiceMockRecorder) GetByIDs

func (mr *MockJwtRepositoryServiceMockRecorder) GetByIDs(tenantID, userID, tokenID interface{}) *gomock.Call

GetByIDs indicates an expected call of GetByIDs

func (*MockJwtRepositoryServiceMockRecorder) Remove

func (mr *MockJwtRepositoryServiceMockRecorder) Remove(token interface{}) *gomock.Call

Remove indicates an expected call of Remove

func (*MockJwtRepositoryServiceMockRecorder) RemoveAll

func (mr *MockJwtRepositoryServiceMockRecorder) RemoveAll(tenantID, userID interface{}) *gomock.Call

RemoveAll indicates an expected call of RemoveAll

func (*MockJwtRepositoryServiceMockRecorder) Save

func (mr *MockJwtRepositoryServiceMockRecorder) Save(token interface{}) *gomock.Call

Save indicates an expected call of Save

type MockJwtService

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

MockJwtService is a mock of JwtService interface

func NewMockJwtService

func NewMockJwtService(ctrl *gomock.Controller) *MockJwtService

NewMockJwtService creates a new mock instance

func (*MockJwtService) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockJwtService) SignAndEncode

func (m *MockJwtService) SignAndEncode(attrs JwtAttrs) (string, error)

SignAndEncode mocks base method

func (*MockJwtService) VerifyAndDecode

func (m *MockJwtService) VerifyAndDecode(tokenString string) (JwtAttrs, error)

VerifyAndDecode mocks base method

type MockJwtServiceMockRecorder

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

MockJwtServiceMockRecorder is the mock recorder for MockJwtService

func (*MockJwtServiceMockRecorder) SignAndEncode

func (mr *MockJwtServiceMockRecorder) SignAndEncode(attrs interface{}) *gomock.Call

SignAndEncode indicates an expected call of SignAndEncode

func (*MockJwtServiceMockRecorder) VerifyAndDecode

func (mr *MockJwtServiceMockRecorder) VerifyAndDecode(tokenString interface{}) *gomock.Call

VerifyAndDecode indicates an expected call of VerifyAndDecode

type MockPasswordService

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

MockPasswordService is a mock of PasswordService interface

func NewMockPasswordService

func NewMockPasswordService(ctrl *gomock.Controller) *MockPasswordService

NewMockPasswordService creates a new mock instance

func (*MockPasswordService) Create

func (m *MockPasswordService) Create(salt []byte, password string) ([]byte, error)

Create mocks base method

func (*MockPasswordService) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockPasswordService) Verify

func (m *MockPasswordService) Verify(salt []byte, srcPassword string, hashedPassword []byte) (bool, error)

Verify mocks base method

type MockPasswordServiceMockRecorder

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

MockPasswordServiceMockRecorder is the mock recorder for MockPasswordService

func (*MockPasswordServiceMockRecorder) Create

func (mr *MockPasswordServiceMockRecorder) Create(salt, password interface{}) *gomock.Call

Create indicates an expected call of Create

func (*MockPasswordServiceMockRecorder) Verify

func (mr *MockPasswordServiceMockRecorder) Verify(salt, srcPassword, hashedPassword interface{}) *gomock.Call

Verify indicates an expected call of Verify

type MockUserApp

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

MockUserApp is a mock of UserApp interface

func NewMockUserApp

func NewMockUserApp(ctrl *gomock.Controller) *MockUserApp

NewMockUserApp creates a new mock instance

func (*MockUserApp) ChangePassword

func (m *MockUserApp) ChangePassword(tenantID TenantID, userID UserID, oldPassword, newPassword string) (*User, error)

ChangePassword mocks base method

func (*MockUserApp) Create

func (m *MockUserApp) Create(tenantID TenantID, user *User) (*User, error)

Create mocks base method

func (*MockUserApp) EXPECT

func (m *MockUserApp) EXPECT() *MockUserAppMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

func (*MockUserApp) GetUserBy

func (m *MockUserApp) GetUserBy(tenantID TenantID, login, password string) (*User, error)

GetUserBy mocks base method

func (*MockUserApp) ResetPassword

func (m *MockUserApp) ResetPassword(tenantID TenantID, userID UserID, newPassword string) (*User, error)

ResetPassword mocks base method

type MockUserAppMockRecorder

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

MockUserAppMockRecorder is the mock recorder for MockUserApp

func (*MockUserAppMockRecorder) ChangePassword

func (mr *MockUserAppMockRecorder) ChangePassword(tenantID, userID, oldPassword, newPassword interface{}) *gomock.Call

ChangePassword indicates an expected call of ChangePassword

func (*MockUserAppMockRecorder) Create

func (mr *MockUserAppMockRecorder) Create(tenantID, user interface{}) *gomock.Call

Create indicates an expected call of Create

func (*MockUserAppMockRecorder) GetUserBy

func (mr *MockUserAppMockRecorder) GetUserBy(tenantID, login, password interface{}) *gomock.Call

GetUserBy indicates an expected call of GetUserBy

func (*MockUserAppMockRecorder) ResetPassword

func (mr *MockUserAppMockRecorder) ResetPassword(tenantID, userID, newPassword interface{}) *gomock.Call

ResetPassword indicates an expected call of ResetPassword

type MockUserRepositoryService

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

MockUserRepositoryService is a mock of UserRepositoryService interface

func NewMockUserRepositoryService

func NewMockUserRepositoryService(ctrl *gomock.Controller) *MockUserRepositoryService

NewMockUserRepositoryService creates a new mock instance

func (*MockUserRepositoryService) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockUserRepositoryService) GetByIDs

func (m *MockUserRepositoryService) GetByIDs(tenantID TenantID, userID UserID) (*User, error)

GetByIDs mocks base method

func (*MockUserRepositoryService) GetByLogin

func (m *MockUserRepositoryService) GetByLogin(tenantID TenantID, login string) (*User, error)

GetByLogin mocks base method

func (*MockUserRepositoryService) Save

func (m *MockUserRepositoryService) Save(user *User) (*User, error)

Save mocks base method

type MockUserRepositoryServiceMockRecorder

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

MockUserRepositoryServiceMockRecorder is the mock recorder for MockUserRepositoryService

func (*MockUserRepositoryServiceMockRecorder) GetByIDs

func (mr *MockUserRepositoryServiceMockRecorder) GetByIDs(tenantID, userID interface{}) *gomock.Call

GetByIDs indicates an expected call of GetByIDs

func (*MockUserRepositoryServiceMockRecorder) GetByLogin

func (mr *MockUserRepositoryServiceMockRecorder) GetByLogin(tenantID, login interface{}) *gomock.Call

GetByLogin indicates an expected call of GetByLogin

func (*MockUserRepositoryServiceMockRecorder) Save

func (mr *MockUserRepositoryServiceMockRecorder) Save(user interface{}) *gomock.Call

Save indicates an expected call of Save

type PasswordService

type PasswordService interface {
	Create(salt []byte, password string) ([]byte, error)
	Verify(salt []byte, srcPassword string, hashedPassword []byte) (bool, error)
}

PasswordService .

type TenantID

type TenantID = string

TenantID .

type User

type User struct {
	ID       UserID `json:"id"`
	Name     string `json:"name,omitempty"`
	Login    string `json:"login"`
	Password string `json:"password"`
	IsActive bool   `json:"is_active"`
}

User .

type UserApp

type UserApp interface {
	Create(tenantID TenantID, user *User) (*User, error)
	GetUserBy(tenantID TenantID, login string, password string) (*User, error)
	ChangePassword(tenantID TenantID, userID UserID, oldPassword, newPassword string) (*User, error)
	ResetPassword(tenantID TenantID, userID UserID, newPassword string) (*User, error)
}

UserApp .

type UserID

type UserID = string

UserID .

type UserRepositoryService

type UserRepositoryService interface {
	GetByLogin(tenantID TenantID, login string) (*User, error)
	GetByIDs(tenantID TenantID, userID UserID) (*User, error)
	Save(user *User) (*User, error)
}

UserRepositoryService .

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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