Documentation
¶
Overview ¶
Package session provides simple in-memory session management for nftban-ui.
Index ¶
- Variables
- func GenerateToken() (string, error)
- type Session
- type Store
- func (s *Store) Cleanup() int
- func (s *Store) Count() int
- func (s *Store) Create(username string, groups []string, clientIP string) (*Session, error)
- func (s *Store) Delete(token string)
- func (s *Store) DeleteByUser(username string) int
- func (s *Store) Get(token string) (*Session, error)
- func (s *Store) List() []*Session
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func GenerateToken ¶
GenerateToken creates a random 32-byte token
Types ¶
type Session ¶
type Session struct {
Token string `json:"token"`
Username string `json:"username"`
Groups []string `json:"groups"`
ClientIP string `json:"client_ip,omitempty"`
CreatedAt time.Time `json:"created_at"`
ExpiresAt time.Time `json:"expires_at"`
}
Session represents an authenticated user session
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is a simple in-memory session store
func (*Store) DeleteByUser ¶
DeleteByUser removes all sessions for a user
Click to show internal directories.
Click to hide internal directories.