infra

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: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMemorySession

func NewMemorySession(prefix string, expire uint32) app.SessionStorage

Types

type Container

type Container struct {
	app.Container
	// contains filtered or unexported fields
}

Container is object stores using Service Locator pattern

func NewContainer

func NewContainer() *Container

NewContainer returns Container object

func (*Container) Close

func (c *Container) Close()

Close provides closing process

func (*Container) Database

func (c *Container) Database() app.Database

Database returns database object

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) Register

func (c *Container) Register(name string, obj interface{})

Register provides store given object by given name

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) FindMulti

func (u *UserRepository) FindMulti(ids []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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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