Documentation ¶
Index ¶
- Constants
- type Permission
- type PermissionStore
- func (ps *PermissionStore) Flush()
- func (ps *PermissionStore) Get(service string, name string) (*Permission, error)
- func (ps *PermissionStore) GetDefaultPermission() (*Permission, error)
- func (ps *PermissionStore) Set(service string, name string, permission *Permission) error
- func (ps *PermissionStore) SetDefaultPermission(permission *Permission) error
- type Session
- type SessionMgr
- type SessionStore
- func (ss *SessionStore) Del(w http.ResponseWriter, r *http.Request) (err error, code int)
- func (ss *SessionStore) DelById(sessionId string) error
- func (ss *SessionStore) Get(r *http.Request) (s *Session, err error)
- func (ss *SessionStore) GetAll() (sessionList []*Session, err error)
- func (ss *SessionStore) GetByName(provider string, username string) (s *Session, err error)
- func (ss *SessionStore) GetCount() (count int)
- func (ss *SessionStore) Refresh(w http.ResponseWriter, r *http.Request) (err error, code int)
- func (ss *SessionStore) Set(s *Session, w http.ResponseWriter, r *http.Request) (err error, code int)
- type SessionTimeoutHandler
Constants ¶
const ( ModeBlock = "block" ModeAllow = "allow" ModeVerify = "verify" )
const ( AccessDenied = "block" AccessGranted = "allow" )
const ( ValSessionID = "sid" ValUsername = "user" ValProvider = "provider" ValSandbox = "sbox" ValRole = "role" ValTimestamp = "timestamp" ValStartTime = "starttime" )
const ( RoleDefault = "default" RoleUser = "user" RoleAdmin = "admin" )
const DefaultPermissionName = "default"
const FieldMode = "Mode"
const SessionDuration = 1200 // 20 minutes
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Permission ¶
type PermissionStore ¶
type PermissionStore struct {
// contains filtered or unexported fields
}
func NewPermissionStore ¶
func NewPermissionStore(addr string) (ps *PermissionStore, err error)
NewPermissionStore - Create and initialize a Permission Store instance
func (*PermissionStore) Flush ¶
func (ps *PermissionStore) Flush()
Flush - Remove all entries in permission store
func (*PermissionStore) Get ¶
func (ps *PermissionStore) Get(service string, name string) (*Permission, error)
Get - Retrieve permission from store
func (*PermissionStore) GetDefaultPermission ¶
func (ps *PermissionStore) GetDefaultPermission() (*Permission, error)
GetDefaultPermission - Get default permission from store
func (*PermissionStore) Set ¶
func (ps *PermissionStore) Set(service string, name string, permission *Permission) error
Set - Create permission in table
func (*PermissionStore) SetDefaultPermission ¶
func (ps *PermissionStore) SetDefaultPermission(permission *Permission) error
SetDefaultPermission - Set default permission
type SessionMgr ¶
type SessionMgr struct {
// contains filtered or unexported fields
}
func NewSessionMgr ¶
func NewSessionMgr(service string, sboxName string, ssAddr string, psAddr string) (sm *SessionMgr, err error)
NewSessionStore - Create and initialize a Session Store instance
func (*SessionMgr) GetPermissionStore ¶
func (sm *SessionMgr) GetPermissionStore() *PermissionStore
GetPermissionTable - Retrieve permission table instance
func (*SessionMgr) GetSessionStore ¶
func (sm *SessionMgr) GetSessionStore() *SessionStore
GetSessionStore - Retrieve session store instance
func (*SessionMgr) StartSessionWatchdog ¶
func (sm *SessionMgr) StartSessionWatchdog(handler SessionTimeoutHandler) error
StartSessionWatchdog - Start Session Watchdog
func (*SessionMgr) StopSessionWatchdog ¶
func (sm *SessionMgr) StopSessionWatchdog()
StopSessionWatchdog - Stop Session Watchdog
type SessionStore ¶
type SessionStore struct {
// contains filtered or unexported fields
}
func NewSessionStore ¶
func NewSessionStore(addr string) (ss *SessionStore, err error)
NewSessionStore - Create and initialize a Session Store instance
func (*SessionStore) Del ¶
func (ss *SessionStore) Del(w http.ResponseWriter, r *http.Request) (err error, code int)
Del - Remove session by cookie
func (*SessionStore) DelById ¶
func (ss *SessionStore) DelById(sessionId string) error
Del - Remove session by ID
func (*SessionStore) Get ¶
func (ss *SessionStore) Get(r *http.Request) (s *Session, err error)
Get - Retrieve session by ID
func (*SessionStore) GetAll ¶
func (ss *SessionStore) GetAll() (sessionList []*Session, err error)
GetAll - Retrieve session by name
func (*SessionStore) GetByName ¶
func (ss *SessionStore) GetByName(provider string, username string) (s *Session, err error)
GetByName - Retrieve session by name
func (*SessionStore) GetCount ¶
func (ss *SessionStore) GetCount() (count int)
GetCount - Retrieve session count
func (*SessionStore) Refresh ¶
func (ss *SessionStore) Refresh(w http.ResponseWriter, r *http.Request) (err error, code int)
Refresh - Remove session by ID
func (*SessionStore) Set ¶
func (ss *SessionStore) Set(s *Session, w http.ResponseWriter, r *http.Request) (err error, code int)
Set - Create session
type SessionTimeoutHandler ¶
type SessionTimeoutHandler func(*Session)