session

package
v0.0.0-...-c6dfff9 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitSessionService

func InitSessionService(sc *Config) error

func SetSessionService

func SetSessionService(newSs *Service)

Types

type Config

type Config struct {
	Type      string    `yaml:"type"`
	Expires   int       `yaml:"expires"`
	Jwt       JWT       `yaml:"jwt,omitempty"`
	DataStore DataStore `yaml:"dataStore,omitempty"`
}

type DataStore

type DataStore struct {
	Type       string
	Properties map[string]string
}

type JWT

type JWT struct {
	Issuer        string `yaml:"issuer"`
	PrivateKeyPem string `yml:"privateKeyPem"`
}

type Jwt

type Jwt struct {
	PrivateKeyID string
	Issuer       string
	PrivateKey   *rsa.PrivateKey
	PublicKey    *rsa.PublicKey
}

type Service

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

func GetSessionService

func GetSessionService() *Service

func (*Service) ConvertSessionToJwt

func (ss *Service) ConvertSessionToJwt(sessID string) (string, error)

func (*Service) CreateSession

func (ss *Service) CreateSession(session Session) (Session, error)

func (*Service) CreateUserSession

func (ss *Service) CreateUserSession(userID string) (sessID string, err error)

func (*Service) DeleteSession

func (ss *Service) DeleteSession(id string) error

func (*Service) GetJwtPublicKey

func (ss *Service) GetJwtPublicKey() *rsa.PublicKey

func (*Service) GetSession

func (ss *Service) GetSession(id string) (Session, error)

func (*Service) GetSessionData

func (ss *Service) GetSessionData(sessionID string) (sess map[string]interface{}, err error)

func (*Service) UpdateSession

func (ss *Service) UpdateSession(session Session) error

type Session

type Session struct {
	ID         string            `json:"id,omitempty"`
	CreatedAt  time.Time         `json:"createdat,omitempty" bson:"createdAt"`
	Properties map[string]string `json:"properties,omitempty"`
}

SessionDataStore struct represents session object from session service

func (*Session) GetRealm

func (s *Session) GetRealm() string

func (*Session) GetUserID

func (s *Session) GetUserID() string

func (*Session) SetUserID

func (s *Session) SetUserID(userID string)

Jump to

Keyboard shortcuts

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