session

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const SYSTEM_USER string = "system"

Variables

View Source
var PUBLIC_ROLES = []Role{
	ROLE_ADMIN,
}

Functions

func IsPrivateRole

func IsPrivateRole(role Role) bool

Types

type ClientData

type ClientData struct {
	Owner       string `json:"username"`
	Timestamp   int64  `json:"timestamp"`
	Transient   string `json:"transient"`
	Persistent  string `json:"persistent"`
	Collections string `json:"collections"`
	Modified    int64  `json:"modified"`
}

func NewClientData

func NewClientData(owner, transient, persistent, collections string) *ClientData

func (ClientData) PersistenceId

func (r ClientData) PersistenceId() string

type RepositorySession

type RepositorySession interface {
	FindAll() []Session
	Find(user string) (*Session, bool)
	Insert(session *Session) *Session
	Delete(session *Session) *Session
}

type RepositorySessionData

type RepositorySessionData interface {
	Find(owner string) (*ClientData, bool)
	Insert(data *ClientData) *ClientData
	Update(data *ClientData) (*ClientData, bool)
	Delete(data *ClientData) *ClientData
}

type Role

type Role string
const (
	ROLE_ADMIN     Role = "admin"
	ROLE_PROTECTED Role = "protected"
	ROLE_ANONYMOUS Role = "anonymous"
)

func CleanPrivateRoles

func CleanPrivateRoles(roles []Role) []Role

func RoleFromString

func RoleFromString(role string) (Role, bool)

func Unique

func Unique(roles []Role) []Role

type Session

type Session struct {
	Username  string `json:"username"`
	Lock      bool   `json:"lock"`
	Secret    []byte `json:"secret"`
	Timestamp int64  `json:"timestamp"`
	Publisher string `json:"publisher"`
	Count     int    `json:"count"`
	Refresh   string `json:"refresh"`
	Roles     []Role `json:"roles"`
}

func (Session) HasRole

func (s Session) HasRole(role Role) bool

func (Session) IsNotVerified

func (s Session) IsNotVerified() bool

func (Session) IsVerified

func (s Session) IsVerified() bool

type SessionLite

type SessionLite struct {
	Username  string `json:"username"`
	Lock      bool   `json:"lock"`
	Timestamp int64  `json:"timestamp"`
	Publisher string `json:"publisher"`
	Count     int    `json:"count"`
	Roles     []Role `json:"roles"`
}

func ToLite

func ToLite(session Session) *SessionLite

type SessionSafe

type SessionSafe struct {
	Username  string `json:"username"`
	Lock      bool   `json:"lock"`
	Timestamp int64  `json:"timestamp"`
	Count     int    `json:"count"`
	Roles     []Role `json:"roles"`
}

func ToSafe

func ToSafe(session Session) *SessionSafe

Jump to

Keyboard shortcuts

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