Documentation ¶
Index ¶
- Variables
- func LabelAddService(opID, tenantID, key string, container interface{ ... }) error
- func UserAddRoleService(opid, tgtid string, roles []string, container interface{ ... }) error
- func UserDeleteRoleService(opid, tgtid string, roles []string, container interface{ ... }) error
- func UserRegisterService(opid, mail string, container interface{ ... }) error
- type Container
- type CtxKey
- type Database
- type DatabaseMutateResult
- type DatabaseSelectResult
- type DatabaseTransaction
- type OAuth2Google
- type OAuth2GoogleTokenInfo
- type SessionData
- type SessionStorage
- type UserDTO
- type UserTokenClaims
- type UserTokenSerializer
Constants ¶
This section is empty.
Variables ¶
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 Database ¶
type Database interface { Close() Select(string, []interface{}, error) ([]DatabaseSelectResult, error) NewTransaction() DatabaseTransaction }
type DatabaseMutateResult ¶
type DatabaseSelectResult ¶
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 SessionData ¶
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