session

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2022 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Session

type Session struct {
	Token     []byte
	SessionID string
	UserID    string
	Expires   int64
}

Session represents a user session at the portal API. A session is identified by its token rather than its session ID as the session ID is an optional field whose presence depends on whether the OIDC provider implements OpenID session management.

type Storage

type Storage interface {
	// GetByRawToken retrieves a session by its raw (prior hashing) token
	GetByRawToken(ctx context.Context, rawToken string) (*Session, error)

	// Create creates a new session
	Create(ctx context.Context, userID, sessionID string, expires int64) (string, error)

	// TerminateBySessionID terminates a session by its session ID
	TerminateBySessionID(ctx context.Context, sessionID string) error

	// TerminateByUserID terminates all sessions of a specific user ID
	TerminateByUserID(ctx context.Context, userID string) error

	// TerminateExpired terminates all sessions that are expired
	TerminateExpired(ctx context.Context) (int, error)
}

Storage defines the session storage API

Directories

Path Synopsis
storage

Jump to

Keyboard shortcuts

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