Documentation
¶
Index ¶
- func GenerateToken(role, secret string, expiry ...time.Duration) (string, error)
- func Middleware(cfg MiddlewareConfig, forceDBE bool, getDBName GetDatabaseNameFn) heligo.Middleware
- type Claims
- type GetDatabaseNameFn
- type MiddlewareConfig
- type Session
- type SessionList
- type SessionManager
- type SessionStatistics
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateToken ¶
GenerateToken creates a signed JWT for the given role. If expiry > 0, the token will include exp and iat claims. If expiry == 0, the token has no expiration (for testing or long-lived tokens).
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
RawClaims string `json:"-"`
}
func (*Claims) UnmarshalJSON ¶ added in v0.2.11
type MiddlewareConfig ¶
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 ¶
Click to show internal directories.
Click to hide internal directories.