Documentation ¶
Index ¶
- func NewMemorySession(prefix string, expire uint32) app.SessionStorage
- type Container
- func (c *Container) Close()
- func (c *Container) Database() app.Database
- func (c *Container) LabelRepository() domain.LabelRepository
- func (c *Container) OAuth2Google() app.OAuth2Google
- func (c *Container) Register(name string, obj interface{})
- func (c *Container) RoleRepository() *domain.RoleRepository
- func (c *Container) SessionStorage() app.SessionStorage
- func (c *Container) TenantRepository() domain.TenantRepository
- func (c *Container) UserRepository() domain.UserRepository
- func (c *Container) UserTokenSerializer() app.UserTokenSerializer
- type MemorySession
- type OAuth2Google
- type OAuth2GoogleTokenInfo
- type SessionData
- type UserRepository
- type UserTokenClaims
- type UserTokenSerializer
- func (s *UserTokenSerializer) Deserialize(tokenString string) (app.UserTokenClaims, error)
- func (s *UserTokenSerializer) NewClaims() app.UserTokenClaims
- func (s *UserTokenSerializer) RestoreClaims(claims map[string]interface{}) app.UserTokenClaims
- func (s *UserTokenSerializer) SecretKey() []byte
- func (s *UserTokenSerializer) Serialize(claims app.UserTokenClaims) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMemorySession ¶
func NewMemorySession(prefix string, expire uint32) app.SessionStorage
Types ¶
type Container ¶
Container is object stores using Service Locator pattern
func (*Container) LabelRepository ¶
func (c *Container) LabelRepository() domain.LabelRepository
LabelRepository is interface for fetching domain.LabelRepository from container stores
func (*Container) OAuth2Google ¶
func (c *Container) OAuth2Google() app.OAuth2Google
OAuth2Google is interface for fetching app.OAuth2Google from container stores
func (*Container) RoleRepository ¶
func (c *Container) RoleRepository() *domain.RoleRepository
RoleRepository is interface for fetching domain.RoleRepository from container stores
func (*Container) SessionStorage ¶
func (c *Container) SessionStorage() app.SessionStorage
func (*Container) TenantRepository ¶
func (c *Container) TenantRepository() domain.TenantRepository
TenantRepository is interface for fetching domain.TenantRepository from container stores
func (*Container) UserRepository ¶
func (c *Container) UserRepository() domain.UserRepository
UserRepository is interface for fetching domain.UserRepository from container stores
func (*Container) UserTokenSerializer ¶
func (c *Container) UserTokenSerializer() app.UserTokenSerializer
UserTokenSerializer is interface for fetching app.UserTokenSerializer from container stores
type MemorySession ¶
type MemorySession struct { app.SessionStorage // contains filtered or unexported fields }
MemorySession provides in-memory session storage for simple system
func (*MemorySession) Find ¶
func (s *MemorySession) Find(id string) app.SessionData
func (*MemorySession) New ¶
func (s *MemorySession) New(id string) app.SessionData
func (*MemorySession) Remove ¶
func (s *MemorySession) Remove(id string) bool
func (*MemorySession) Save ¶
func (s *MemorySession) Save(id string, d app.SessionData)
type OAuth2Google ¶
type OAuth2Google struct { app.OAuth2Google // contains filtered or unexported fields }
OAuth2Google provides google oauth2 interface for getting user's profile
func NewOAuth2Google ¶
func NewOAuth2Google(clientID, clientSecret, redirectURL string) *OAuth2Google
NewOAuth2Google returns new OAuth2Google object
func (*OAuth2Google) AuthCodeURL ¶
func (o *OAuth2Google) AuthCodeURL(state string) string
AuthCodeURL returns URL to oauth permission page
func (*OAuth2Google) GetTokenInfo ¶
func (o *OAuth2Google) GetTokenInfo(code string) (app.OAuth2GoogleTokenInfo, error)
GetTokenInfo returns OAuth2GoogleTokenInfo object using oauth2 protocol
type OAuth2GoogleTokenInfo ¶
type OAuth2GoogleTokenInfo struct { app.OAuth2GoogleTokenInfo // contains filtered or unexported fields }
OAuth2GoogleTokenInfo is data transfer object for user profile
func NewUserTokenInfo ¶
func NewUserTokenInfo(id, email string, exp time.Time) *OAuth2GoogleTokenInfo
func (*OAuth2GoogleTokenInfo) Email ¶
func (i *OAuth2GoogleTokenInfo) Email() string
Email returns user's email from profile
func (*OAuth2GoogleTokenInfo) ExpiresAt ¶
func (i *OAuth2GoogleTokenInfo) ExpiresAt() time.Time
ExpiresAt returns when user token expires
func (*OAuth2GoogleTokenInfo) UserID ¶
func (i *OAuth2GoogleTokenInfo) UserID() string
UserID returns user's id from profile
type SessionData ¶
type SessionData struct { app.SessionData // contains filtered or unexported fields }
func (*SessionData) Get ¶
func (d *SessionData) Get(name string) interface{}
func (*SessionData) Remove ¶
func (d *SessionData) Remove(name string) bool
func (*SessionData) Set ¶
func (d *SessionData) Set(name string, val interface{})
type UserRepository ¶
type UserRepository struct { domain.UserRepository // contains filtered or unexported fields }
UserRepository provides implementation for User domain model's data load and store
func NewUserRepository ¶
func NewUserRepository(db app.Database) *UserRepository
NewUserRepository returns implemented UserRepository object
func (*UserRepository) DispenseID ¶
func (u *UserRepository) DispenseID() domain.UserID
DispenseID returns new ID for User domain model
func (*UserRepository) Find ¶
func (u *UserRepository) Find(id string) *domain.User
Find returns User domain model object selecting by id
func (*UserRepository) FindByMail ¶
func (u *UserRepository) FindByMail(mailAddress string) *domain.User
func (*UserRepository) Save ¶
func (u *UserRepository) Save(du *domain.User)
type UserTokenClaims ¶
type UserTokenClaims struct { app.UserTokenClaims // contains filtered or unexported fields }
UserTokenClaims is wrapper for JWT Claims
func (*UserTokenClaims) Claims ¶
func (c *UserTokenClaims) Claims() map[string]interface{}
Claims returns plain map object
func (*UserTokenClaims) Expired ¶
func (c *UserTokenClaims) Expired() bool
Expired returns whether this claims' expirenation is over or not
func (*UserTokenClaims) FindSessionID ¶
func (c *UserTokenClaims) FindSessionID() string
FindSessionID returns session id which is already created
func (*UserTokenClaims) FindUserID ¶
func (c *UserTokenClaims) FindUserID() string
FindUserID returns user id from claims
func (*UserTokenClaims) UserID ¶
func (c *UserTokenClaims) UserID(id string)
UserID provides setting user id to claims
type UserTokenSerializer ¶
type UserTokenSerializer struct { app.UserTokenSerializer // contains filtered or unexported fields }
UserTokenSerializer provides JWT based token serialization and deserialization
func NewUserTokenSerializer ¶
func NewUserTokenSerializer(method, skey string, h uint32) *UserTokenSerializer
NewUserTokenSerializer returns UserTokenSerializer object
func (*UserTokenSerializer) Deserialize ¶
func (s *UserTokenSerializer) Deserialize(tokenString string) (app.UserTokenClaims, error)
Deserialize returns plain claims from token
func (*UserTokenSerializer) NewClaims ¶
func (s *UserTokenSerializer) NewClaims() app.UserTokenClaims
NewClaims returns UserTokenClaims object
func (*UserTokenSerializer) RestoreClaims ¶
func (s *UserTokenSerializer) RestoreClaims(claims map[string]interface{}) app.UserTokenClaims
RestoreClaims returns UserTokenClaims object from Claims object
func (*UserTokenSerializer) SecretKey ¶
func (s *UserTokenSerializer) SecretKey() []byte
SecretKey returns binarized secret key
func (*UserTokenSerializer) Serialize ¶
func (s *UserTokenSerializer) Serialize(claims app.UserTokenClaims) (string, error)
Serialize returns token from plain claims