sessionmanager

package
v0.0.0-...-dbbace4 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2018 License: LGPL-3.0 Imports: 6 Imported by: 1

Documentation

Overview

Package sessionmanager is used to implement model.SM interface. Its purpose is controlling sessions of clients that are used for authentification.

Session manager uses key-value storage Redis for sessions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	DBAddress      string `json:"DBAddress,"`
	TockenLength   int    `json:"TockenLength,int"`
	ExpirationTime int    `json:"ExpirationTime,int"`
}

Config is a struct for configuring session manager.

type SessionManager

type SessionManager struct {
	// contains filtered or unexported fields
}

SessionManager stores connection to redis database.

func InitConnSM

func InitConnSM(cfg Config) (*SessionManager, error)

InitConnSM initiates connection to redis database. It returns struct that implements model.SM interface used by API to interact with sessions.

func (*SessionManager) CheckSession

func (sm *SessionManager) CheckSession(in *model.SessionID) (*model.Session, error)

CheckSession checks if session with such ID exists in database.

func (*SessionManager) CreateSession

func (sm *SessionManager) CreateSession(in *model.Session, expires bool) (*model.SessionID, error)

CreateSession creates new session in database.

func (*SessionManager) DeleteSession

func (sm *SessionManager) DeleteSession(in *model.SessionID) error

DeleteSession deletes session with such ID.

func (*SessionManager) IsConnected

func (sm *SessionManager) IsConnected() bool

IsConnected checks if connection is active

func (*SessionManager) TryReconnect

func (sm *SessionManager) TryReconnect() error

TryReconnect reconnects to redis

Jump to

Keyboard shortcuts

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