Documentation
¶
Index ¶
- Constants
- type Manager
- func (m *Manager) CreateSession(ctx context.Context, forgejoAuthID int32, username, issuer string) (*Session, error)
- func (m *Manager) DeleteSession(ctx context.Context, sessionID string)
- func (m *Manager) GetSession(ctx context.Context, sessionID string) (*Session, bool)
- func (m *Manager) IsValid(ctx context.Context, sessionID string) bool
- func (m *Manager) Stop()
- type Session
Constants ¶
View Source
const ( // CookieName is the name of the session cookie CookieName = "forrus_cookie" // SessionTTL is the time-to-live for sessions (7 days) SessionTTL = 7 * 24 * time.Hour // CleanupInterval is how often to run the cleanup goroutine CleanupInterval = 1 * time.Hour )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages user sessions in memory
func NewManager ¶
func NewManager() *Manager
NewManager creates a new session manager and starts the cleanup goroutine
func (*Manager) CreateSession ¶
func (m *Manager) CreateSession(ctx context.Context, forgejoAuthID int32, username, issuer string) (*Session, error)
CreateSession creates a new session for the user
func (*Manager) DeleteSession ¶
DeleteSession removes a session
func (*Manager) GetSession ¶
GetSession retrieves a session by ID and updates last accessed time
Click to show internal directories.
Click to hide internal directories.