Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrTokenNotFound = errors.New("token not found")
)
Functions ¶
This section is empty.
Types ¶
type SessionStore ¶
type SessionStore struct {
// contains filtered or unexported fields
}
SessionStore implements in-memory session-based CSRF token storage
func NewSessionStore ¶
func NewSessionStore(lifetime ...time.Duration) *SessionStore
NewSessionStore creates a new session-based token store. An optional lifetime can be provided; defaults to 24h if zero or omitted.
IMPORTANT: Close() must be called when the store is no longer needed to stop the background cleanup goroutine. Wire Close() into your server's shutdown hook to prevent goroutine leaks. The cleanup goroutine starts immediately upon creation.
func (*SessionStore) Close ¶ added in v0.9.2
func (s *SessionStore) Close()
Close stops the background cleanup goroutine.
func (*SessionStore) Exists ¶
func (s *SessionStore) Exists(id string) bool
Exists checks if a token exists and is not expired
Click to show internal directories.
Click to hide internal directories.