sesh

package
v0.1548.0-scratch.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package sesh provides functionality for setting and reading session data as cookies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CsrfSession added in v0.1051.0

type CsrfSession struct {
	IsNew bool
	Token string
}

func (CsrfSession) Valid added in v0.1051.0

func (s CsrfSession) Valid() bool

type DynamoClient added in v0.1539.0

type DynamoClient interface {
	Create(ctx context.Context, v any) error
	One(ctx context.Context, pk dynamo.PK, sk dynamo.SK, v any) error
	DeleteOne(ctx context.Context, pk dynamo.PK, sk dynamo.SK) error
}

type DynamoStore added in v0.1539.0

type DynamoStore struct {
	Codecs  []securecookie.Codec
	Options *sessions.Options
	// contains filtered or unexported fields
}

DynamoStore stores sessions in DynamoDB.

func NewDynamoStore added in v0.1539.0

func NewDynamoStore(dynamoClient DynamoClient, keyPairs ...[]byte) *DynamoStore

func (*DynamoStore) Get added in v0.1539.0

func (s *DynamoStore) Get(r *http.Request, name string) (*sessions.Session, error)

func (*DynamoStore) New added in v0.1539.0

func (s *DynamoStore) New(r *http.Request, name string) (*sessions.Session, error)

func (*DynamoStore) Save added in v0.1539.0

func (s *DynamoStore) Save(r *http.Request, w http.ResponseWriter, session *sessions.Session) error

type InvalidSessionError

type InvalidSessionError string

func (InvalidSessionError) Error

func (e InvalidSessionError) Error() string

type LoginSession

type LoginSession struct {
	IDToken          string
	Sub              string
	Email            string
	OrganisationID   string
	OrganisationName string
}

func (LoginSession) SessionID added in v0.986.0

func (s LoginSession) SessionID() string

SessionID is a safe version of the OneLogin sub, that is used to form DynamoDB keys. Note: this is not the identifier stored in the "session" cookie.

func (LoginSession) Valid

func (s LoginSession) Valid() bool

type LpaDataSession added in v0.1181.0

type LpaDataSession struct {
	LpaID string
}

func (LpaDataSession) Valid added in v0.1181.0

func (s LpaDataSession) Valid() bool

type MissingSessionError

type MissingSessionError string

func (MissingSessionError) Error

func (e MissingSessionError) Error() string

type OneLoginSession

type OneLoginSession struct {
	State     string
	Nonce     string
	Locale    string
	Redirect  string
	SessionID string
	LpaID     string
}

func (OneLoginSession) Valid

func (s OneLoginSession) Valid() bool

type PaymentSession

type PaymentSession struct {
	PaymentID string
}

func (PaymentSession) Valid

func (s PaymentSession) Valid() bool

type Store

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

func NewStore added in v0.1051.0

func NewStore(dynamoClient DynamoClient, keyPairs [][]byte) *Store

func (*Store) ClearLogin added in v0.1051.0

func (s *Store) ClearLogin(r *http.Request, w http.ResponseWriter) error

func (*Store) ClearPayment added in v0.1051.0

func (s *Store) ClearPayment(r *http.Request, w http.ResponseWriter) error

func (*Store) Csrf added in v0.1051.0

func (s *Store) Csrf(r *http.Request) (*CsrfSession, error)

func (*Store) Login added in v0.1051.0

func (s *Store) Login(r *http.Request) (*LoginSession, error)

func (*Store) LpaData added in v0.1181.0

func (s *Store) LpaData(r *http.Request) (*LpaDataSession, error)

func (*Store) OneLogin added in v0.1051.0

func (s *Store) OneLogin(r *http.Request) (*OneLoginSession, error)

func (*Store) Payment added in v0.1051.0

func (s *Store) Payment(r *http.Request) (*PaymentSession, error)

func (*Store) SetCsrf added in v0.1051.0

func (s *Store) SetCsrf(r *http.Request, w http.ResponseWriter, csrfSession *CsrfSession) error

func (*Store) SetLogin added in v0.1051.0

func (s *Store) SetLogin(r *http.Request, w http.ResponseWriter, donorSession *LoginSession) error

func (*Store) SetLpaData added in v0.1181.0

func (s *Store) SetLpaData(r *http.Request, w http.ResponseWriter, lpaDataSession *LpaDataSession) error

func (*Store) SetOneLogin added in v0.1051.0

func (s *Store) SetOneLogin(r *http.Request, w http.ResponseWriter, oneLoginSession *OneLoginSession) error

func (*Store) SetPayment added in v0.1051.0

func (s *Store) SetPayment(r *http.Request, w http.ResponseWriter, paymentSession *PaymentSession) error

Jump to

Keyboard shortcuts

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