authn

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateToken

func GenerateToken(role, secret string) (string, error)

func Middleware

func Middleware(cfg MiddlewareConfig, forceDBE bool, getDBName GetDatabaseNameFn) heligo.Middleware

Types

type Claims

type Claims struct {
	Role string `json:"role"`
	Id   string `json:"id"`
	jwt.RegisteredClaims
}

type GetDatabaseNameFn

type GetDatabaseNameFn func(ctx context.Context, r heligo.Request) string

type MiddlewareConfig

type MiddlewareConfig interface {
	GetDatabase(context.Context, string) (*database.Database, error)
	JWTSecret() string
	AllowAnon() bool
	AnonRole() string
	SessionManager() *SessionManager
	Logger() *logging.Logger
}

type Session

type Session struct {
	Claims     *Claims
	LastUsedAt time.Time
	Db         *database.Database
	DbConn     *database.DbPoolConn
	// contains filtered or unexported fields
}

A Session for SmoothDB is the way to cache information about a user and his connection to a database

type SessionList

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

type SessionManager

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

SessionManager manages user sessions and monitors them efficiently. When disabled, it simply returns Sessions without managing or monitoring.

func NewSessionManager

func NewSessionManager(logger *logging.Logger, enabled bool, shutdown chan struct{}) *SessionManager

func (*SessionManager) Statistics

func (sm *SessionManager) Statistics() SessionStatistics

type SessionStatistics

type SessionStatistics struct {
	Count int
	InUse int
	Users int
}

Jump to

Keyboard shortcuts

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