app

package
v0.0.0-...-a62c2ef Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2018 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// UserIDCtxKey is access key for requestUser in context
	UserIDCtxKey = CtxKey("userID")
	TxnCtxKey    = CtxKey("transaction")
)

Functions

func LabelAddService

func LabelAddService(opID, tenantID, key string, container interface {
	UserRepository() domain.UserRepository
	LabelRepository() domain.LabelRepository
	TenantRepository() domain.TenantRepository
}) error

LabelAddService provides registering label and validation

func UserAddRoleService

func UserAddRoleService(opid, tgtid string, roles []string, container interface {
	UserRepository() domain.UserRepository
	RoleRepository() *domain.RoleRepository
}) error

UserAddRoleService provides attaching role to user

func UserDeleteRoleService

func UserDeleteRoleService(opid, tgtid string, roles []string, container interface {
	UserRepository() domain.UserRepository
	RoleRepository() *domain.RoleRepository
}) error

UserDeleteRoleService provides detaching role from user

func UserRegisterService

func UserRegisterService(opid, mail string, container interface {
	UserRepository() domain.UserRepository
	RoleRepository() *domain.RoleRepository
}) error

UserRegisterService provides user registration application service

Types

type Container

type Container interface {
	Register(string, interface{})
	Close()
	UserTokenSerializer() UserTokenSerializer
	OAuth2Google() OAuth2Google
	UserRepository() domain.UserRepository
	RoleRepository() *domain.RoleRepository
}

Container is interface for infra implementation

type CtxKey

type CtxKey string

CtxKey is access key for context.Context

type Database

type Database interface {
	Close()
	Select(string, []interface{}, error) ([]DatabaseSelectResult, error)
	NewTransaction() DatabaseTransaction
}

type DatabaseMutateResult

type DatabaseMutateResult interface {
	LastInsertId() (int64, error)
	RowsAffected() (int64, error)
}

type DatabaseSelectResult

type DatabaseSelectResult map[string]string

type DatabaseTransaction

type DatabaseTransaction interface {
	Select(string, []interface{}, error) (DatabaseSelectResult, error)
	Mutate(string, []interface{}, error) (DatabaseMutateResult, error)
	Commit()
	Rollback()
}

type OAuth2Google

type OAuth2Google interface {
	AuthCodeURL(string) string
	GetTokenInfo(string) (OAuth2GoogleTokenInfo, error)
}

OAuth2Google is interface for oauth2 library using google provider

type OAuth2GoogleTokenInfo

type OAuth2GoogleTokenInfo interface {
	Email() string
	ExpiresAt() time.Time
	UserID() string
}

type SessionData

type SessionData interface {
	Get(string) interface{}
	Set(string, interface{})
	Remove(string) bool
}

SessionData is interface for session data storage interface for request

type SessionStorage

type SessionStorage interface {
	Find(string) SessionData
	New(string) SessionData
	Save(string, SessionData)
	Remove(string) bool
}

SessionStorage is interface for Session data operation

type UserDTO

type UserDTO struct {
	ID    string   `json:"id"`
	Mail  string   `json:"mail"`
	Roles []string `json:"roles"`
}

UserDTO is data transfer object for user domain

func UserAuthorizeService

func UserAuthorizeService(code string, container interface {
	UserRepository() domain.UserRepository
	RoleRepository() *domain.RoleRepository
	OAuth2Google() OAuth2Google
}) (*UserDTO, error)

UserAuthorizeService provides authorized user registration by google

func UserFindService

func UserFindService(id string, container interface {
	UserRepository() domain.UserRepository
	RoleRepository() *domain.RoleRepository
}) *UserDTO

UserFindService provides retrieving user data using given id

type UserTokenClaims

type UserTokenClaims interface {
	Claims() map[string]interface{}
	FindUserID() string
	UserID(string)
	Expired() bool
	FindSessionID() string
}

UserTokenClaims is interface for user token claims

type UserTokenSerializer

type UserTokenSerializer interface {
	SecretKey() []byte
	Serialize(UserTokenClaims) (string, error)
	Deserialize(string) (UserTokenClaims, error)
	NewClaims() UserTokenClaims
	RestoreClaims(map[string]interface{}) UserTokenClaims
}

UserTokenSerializer is interface for user token serialization

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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