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 ¶
- type BaseStore
- type OIDC
- func (s *OIDC) DestroySession(ctx context.Context, sessionID ccc.UUID) error
- func (s *OIDC) DestroySessionOIDC(ctx context.Context, oidcSID string) error
- func (s *OIDC) NewSession(ctx context.Context, username, oidcSID string) (ccc.UUID, error)
- func (s *OIDC) Session(ctx context.Context, sessionID ccc.UUID) (*sessioninfo.SessionInfo, error)
- func (s *OIDC) SetSessionTableName(name string)
- func (s *OIDC) SetUserTableName(name string)
- func (s *OIDC) UpdateSessionActivity(ctx context.Context, sessionID ccc.UUID) error
- type OIDCStore
- type PasswordAuth
- func (s *PasswordAuth) DestroySession(ctx context.Context, sessionID ccc.UUID) error
- func (s *PasswordAuth) NewSession(ctx context.Context, username string) (ccc.UUID, error)
- func (s *PasswordAuth) Session(ctx context.Context, sessionID ccc.UUID) (*sessioninfo.SessionInfo, error)
- func (s *PasswordAuth) SetSessionTableName(name string)
- func (p *PasswordAuth) SetUserPasswordHash(ctx context.Context, id ccc.UUID, hash *securehash.Hash) error
- func (s *PasswordAuth) SetUserTableName(name string)
- func (s *PasswordAuth) UpdateSessionActivity(ctx context.Context, sessionID ccc.UUID) error
- func (p *PasswordAuth) User(ctx context.Context, id ccc.UUID) (*dbtype.SessionUser, error)
- func (p *PasswordAuth) UserByUserName(ctx context.Context, username string) (*dbtype.SessionUser, error)
- type PasswordAuthStore
- type Preauth
- func (s *Preauth) DestroySession(ctx context.Context, sessionID ccc.UUID) error
- func (s *Preauth) NewSession(ctx context.Context, username string) (ccc.UUID, error)
- func (s *Preauth) Session(ctx context.Context, sessionID ccc.UUID) (*sessioninfo.SessionInfo, error)
- func (s *Preauth) SetSessionTableName(name string)
- func (s *Preauth) SetUserTableName(name string)
- func (s *Preauth) UpdateSessionActivity(ctx context.Context, sessionID ccc.UUID) error
- type PreauthStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseStore ¶ added in v0.6.1
type BaseStore interface {
// Session returns the session information from the database for given sessionID
Session(ctx context.Context, sessionID ccc.UUID) (*sessioninfo.SessionInfo, error)
// UpdateSessionActivity updates the database with the current time for the session activity
UpdateSessionActivity(ctx context.Context, sessionID ccc.UUID) error
// DestroySession marks the session as expired
DestroySession(ctx context.Context, sessionID ccc.UUID) error
// SetSessionTableName sets the name of the session table.
SetSessionTableName(name string)
// SetUserTableName sets the name of the user table.
SetUserTableName(name string)
}
BaseStore defines an interface for managing session storage.
type OIDC ¶ added in v0.6.1
type OIDC struct {
// contains filtered or unexported fields
}
OIDC is the session storage implementation for with OIDC support.
func NewPostgresOIDC ¶
NewPostgresOIDC creates a new PostgresOIDC instance.
func NewSpannerOIDC ¶
func NewSpannerOIDC(client *cloudspanner.Client) *OIDC
NewSpannerOIDC creates a new SpannerOIDCSessionStorage instance.
func (*OIDC) DestroySession ¶ added in v0.6.1
DestroySession marks the session as expired
func (*OIDC) DestroySessionOIDC ¶ added in v0.6.1
DestroySessionOIDC marks the session as expired
func (*OIDC) NewSession ¶ added in v0.6.1
NewSession inserts SessionInfo into database
func (*OIDC) Session ¶ added in v0.6.1
func (s *OIDC) Session(ctx context.Context, sessionID ccc.UUID) (*sessioninfo.SessionInfo, error)
Session returns the session information from the database for given sessionID
func (*OIDC) SetSessionTableName ¶ added in v0.6.1
func (s *OIDC) SetSessionTableName(name string)
SetSessionTableName sets the name of the session table.
func (*OIDC) SetUserTableName ¶ added in v0.6.1
func (s *OIDC) SetUserTableName(name string)
SetUserTableName sets the name of the user table.
type OIDCStore ¶ added in v0.6.1
type OIDCStore interface {
DestroySessionOIDC(ctx context.Context, oidcSID string) error
NewSession(ctx context.Context, username, oidcSID string) (ccc.UUID, error)
// shared storage methods
BaseStore
}
OIDCStore defines an interface for managing OIDC session storage.
type PasswordAuth ¶ added in v0.6.1
type PasswordAuth struct {
// contains filtered or unexported fields
}
PasswordAuth is the session storage implementation with PasswordAuth support.
func NewPostgresPassword ¶ added in v0.6.1
func NewPostgresPassword(pg postgres.Queryer) *PasswordAuth
NewPostgresPassword creates a new PostgresPassword instance.
func NewSpannerPasswordAuth ¶ added in v0.6.1
func NewSpannerPasswordAuth(client *cloudspanner.Client) *PasswordAuth
NewSpannerPasswordAuth creates a new Password storage instance.
func (*PasswordAuth) DestroySession ¶ added in v0.6.1
DestroySession marks the session as expired
func (*PasswordAuth) NewSession ¶ added in v0.6.1
NewSession inserts SessionInfo into the spanner database
func (*PasswordAuth) Session ¶ added in v0.6.1
func (s *PasswordAuth) Session(ctx context.Context, sessionID ccc.UUID) (*sessioninfo.SessionInfo, error)
Session returns the session information from the database for given sessionID
func (*PasswordAuth) SetSessionTableName ¶ added in v0.6.1
func (s *PasswordAuth) SetSessionTableName(name string)
SetSessionTableName sets the name of the session table.
func (*PasswordAuth) SetUserPasswordHash ¶ added in v0.6.1
func (p *PasswordAuth) SetUserPasswordHash(ctx context.Context, id ccc.UUID, hash *securehash.Hash) error
SetUserPasswordHash updates the user password hash
func (*PasswordAuth) SetUserTableName ¶ added in v0.6.1
func (s *PasswordAuth) SetUserTableName(name string)
SetUserTableName sets the name of the user table.
func (*PasswordAuth) UpdateSessionActivity ¶ added in v0.6.1
UpdateSessionActivity updates the database with the current time for the session activity
func (*PasswordAuth) User ¶ added in v0.6.1
func (p *PasswordAuth) User(ctx context.Context, id ccc.UUID) (*dbtype.SessionUser, error)
User returns the user record associated with the username
func (*PasswordAuth) UserByUserName ¶ added in v0.6.1
func (p *PasswordAuth) UserByUserName(ctx context.Context, username string) (*dbtype.SessionUser, error)
UserByUserName returns the user record associated with the username
type PasswordAuthStore ¶ added in v0.6.1
type PasswordAuthStore interface {
// User returns a session user for give user id
User(ctx context.Context, id ccc.UUID) (*dbtype.SessionUser, error)
// UserByUsername returns a session user for give username
UserByUserName(ctx context.Context, username string) (*dbtype.SessionUser, error)
// SetUserPasswordHash updates the user password hash
SetUserPasswordHash(ctx context.Context, id ccc.UUID, hash *securehash.Hash) error
// shared storage methods
PreauthStore
}
PasswordAuthStore defines an interface for managing password sessions.
type Preauth ¶
type Preauth struct {
// contains filtered or unexported fields
}
Preauth is the session storage implementation for Preauth.
func NewPostgresPreauth ¶
NewPostgresPreauth is the function that you use to create the session manager that handles the session creation and updates
func NewSpannerPreauth ¶
func NewSpannerPreauth(db *cloudspanner.Client) *Preauth
NewSpannerPreauth is the function that you use to create the session manager that handles the session creation and updates
func (*Preauth) DestroySession ¶ added in v0.6.1
DestroySession marks the session as expired
func (*Preauth) NewSession ¶
NewSession inserts SessionInfo into the spanner database
func (*Preauth) Session ¶ added in v0.6.1
func (s *Preauth) Session(ctx context.Context, sessionID ccc.UUID) (*sessioninfo.SessionInfo, error)
Session returns the session information from the database for given sessionID
func (*Preauth) SetSessionTableName ¶ added in v0.6.1
func (s *Preauth) SetSessionTableName(name string)
SetSessionTableName sets the name of the session table.
func (*Preauth) SetUserTableName ¶ added in v0.6.1
func (s *Preauth) SetUserTableName(name string)
SetUserTableName sets the name of the user table.
type PreauthStore ¶ added in v0.6.1
type PreauthStore interface {
// NewSession creates a new session in the database, returning its id
NewSession(ctx context.Context, username string) (ccc.UUID, error)
// shared storage methods
BaseStore
}
PreauthStore defines an interface for managing pre-authenticated session storage.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
internal
|
|
|
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. |