sessions

package module
v0.0.0-...-8f6edbe Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModeBlock  = "block"
	ModeAllow  = "allow"
	ModeVerify = "verify"
)
View Source
const (
	AccessDenied  = "block"
	AccessGranted = "allow"
)
View Source
const (
	ValSessionID = "sid"
	ValUsername  = "user"
	ValProvider  = "provider"
	ValSandbox   = "sbox"
	ValRole      = "role"
	ValTimestamp = "timestamp"
	ValStartTime = "starttime"
)
View Source
const (
	RoleDefault = "default"
	RoleUser    = "user"
	RoleAdmin   = "admin"
)
View Source
const DefaultPermissionName = "default"
View Source
const FieldMode = "Mode"
View Source
const SessionDuration = 1200 // 20 minutes

Variables

This section is empty.

Functions

This section is empty.

Types

type Permission

type Permission struct {
	Mode            string
	RolePermissions map[string]string
}

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 Session

type Session struct {
	ID        string
	Username  string
	Provider  string
	Sandbox   string
	Role      string
	Timestamp time.Time
	StartTime time.Time
}

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)

Jump to

Keyboard shortcuts

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