sessionstorage

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package sessionstorage implements database storage for session data. There are implementations for both Spanner and Postgres for each session type (i.e. OIDC, Username/Password, etc)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base interface {
	DestroySession(ctx context.Context, sessionID ccc.UUID) error
	UpdateSessionActivity(ctx context.Context, sessionID ccc.UUID) error
	Session(ctx context.Context, sessionID ccc.UUID) (*sessioninfo.SessionInfo, error)
}

Base defines an interface for managing session storage.

type OIDCAzure

type OIDCAzure interface {
	DestroySessionOIDC(ctx context.Context, oidcSID string) error
	NewSession(ctx context.Context, username, oidcSID string) (ccc.UUID, error)

	// shared storage methods
	Base
}

OIDCAzure defines an interface for managing OIDC sessions.

type PostgresOIDC

type PostgresOIDC struct {
	// contains filtered or unexported fields
}

PostgresOIDC is the session storage implementation for PostgreSQL with OIDC support.

func NewPostgresOIDC

func NewPostgresOIDC(db postgres.Queryer) *PostgresOIDC

NewPostgresOIDC creates a new PostgresOIDC instance.

func (*PostgresOIDC) DestroySession

func (p *PostgresOIDC) DestroySession(ctx context.Context, sessionID ccc.UUID) error

DestroySession marks the session as expired

func (*PostgresOIDC) DestroySessionOIDC

func (p *PostgresOIDC) DestroySessionOIDC(ctx context.Context, oidcSID string) error

DestroySessionOIDC marks the session as expired

func (*PostgresOIDC) NewSession

func (p *PostgresOIDC) NewSession(ctx context.Context, username, oidcSID string) (ccc.UUID, error)

NewSession inserts SessionInfo into database

func (*PostgresOIDC) Session

func (p *PostgresOIDC) Session(ctx context.Context, sessionID ccc.UUID) (*sessioninfo.SessionInfo, error)

Session returns the session information from the database for given sessionID

func (*PostgresOIDC) UpdateSessionActivity

func (p *PostgresOIDC) UpdateSessionActivity(ctx context.Context, sessionID ccc.UUID) error

UpdateSessionActivity updates the database with the current time for the session activity

type PostgresPreauth

type PostgresPreauth struct {
	// contains filtered or unexported fields
}

PostgresPreauth is what you use to create / update sessions inside of the handlers or as a standalone if you don't want the handlers

func NewPostgresPreauth

func NewPostgresPreauth(db postgres.Queryer) *PostgresPreauth

NewPostgresPreauth is the function that you use to create the session manager that handles the session creation and updates

func (*PostgresPreauth) DestroySession

func (p *PostgresPreauth) DestroySession(ctx context.Context, sessionID ccc.UUID) error

DestroySession marks the session as expired

func (*PostgresPreauth) NewSession

func (p *PostgresPreauth) NewSession(ctx context.Context, username string) (ccc.UUID, error)

NewSession inserts SessionInfo into the spanner database

func (*PostgresPreauth) Session

func (p *PostgresPreauth) Session(ctx context.Context, sessionID ccc.UUID) (*sessioninfo.SessionInfo, error)

Session returns the session information from the database for given sessionID

func (*PostgresPreauth) UpdateSessionActivity

func (p *PostgresPreauth) UpdateSessionActivity(ctx context.Context, sessionID ccc.UUID) error

UpdateSessionActivity updates the database with the current time for the session activity

type Preauth

type Preauth interface {
	NewSession(ctx context.Context, username string) (ccc.UUID, error)

	// shared storage methods
	Base
}

Preauth defines an interface for managing pre-authenticated sessions.

type SpannerOIDC

type SpannerOIDC struct {
	// contains filtered or unexported fields
}

SpannerOIDC is the session storage implementation for Spanner with OIDC support.

func NewSpannerOIDC

func NewSpannerOIDC(db *cloudspanner.Client) *SpannerOIDC

NewSpannerOIDC creates a new SpannerOIDCSessionStorage instance.

func (*SpannerOIDC) DestroySession

func (p *SpannerOIDC) DestroySession(ctx context.Context, sessionID ccc.UUID) error

DestroySession marks the session as expired

func (*SpannerOIDC) DestroySessionOIDC

func (p *SpannerOIDC) DestroySessionOIDC(ctx context.Context, oidcSID string) error

DestroySessionOIDC marks the session as expired

func (*SpannerOIDC) NewSession

func (p *SpannerOIDC) NewSession(ctx context.Context, username, oidcSID string) (ccc.UUID, error)

NewSession inserts SessionInfo into database

func (*SpannerOIDC) Session

func (p *SpannerOIDC) Session(ctx context.Context, sessionID ccc.UUID) (*sessioninfo.SessionInfo, error)

Session returns the session information from the database for given sessionID

func (*SpannerOIDC) UpdateSessionActivity

func (p *SpannerOIDC) UpdateSessionActivity(ctx context.Context, sessionID ccc.UUID) error

UpdateSessionActivity updates the database with the current time for the session activity

type SpannerPreauth

type SpannerPreauth struct {
	// contains filtered or unexported fields
}

SpannerPreauth is what you use to create / update sessions inside of the handlers or as a standalone if you don't want the handlers

func NewSpannerPreauth

func NewSpannerPreauth(db *cloudspanner.Client) *SpannerPreauth

NewSpannerPreauth is the function that you use to create the session manager that handles the session creation and updates

func (*SpannerPreauth) DestroySession

func (p *SpannerPreauth) DestroySession(ctx context.Context, sessionID ccc.UUID) error

DestroySession marks the session as expired

func (*SpannerPreauth) NewSession

func (p *SpannerPreauth) NewSession(ctx context.Context, username string) (ccc.UUID, error)

NewSession inserts SessionInfo into the spanner database

func (*SpannerPreauth) Session

func (p *SpannerPreauth) Session(ctx context.Context, sessionID ccc.UUID) (*sessioninfo.SessionInfo, error)

Session returns the session information from the database for given sessionID

func (*SpannerPreauth) UpdateSessionActivity

func (p *SpannerPreauth) UpdateSessionActivity(ctx context.Context, sessionID ccc.UUID) error

UpdateSessionActivity updates the database with the current time for the session activity

Directories

Path Synopsis
internal
dbtype
Package dbtype contains types used by the database driver packages for session storage.
Package dbtype contains types used by the database driver packages for session storage.
postgres
Package postgres implements the session storage driver for PostgreSQL.
Package postgres implements the session storage driver for PostgreSQL.
spanner
Package spanner provides the session storage driver for Spanner.
Package spanner provides the session storage driver for Spanner.
mock
mock_sessionstorage
Package mock_sessionstorage is a generated GoMock package.
Package mock_sessionstorage is a generated GoMock package.

Jump to

Keyboard shortcuts

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