sessions

package
v0.0.0-...-533ea73 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContextKeyAccessTokenName contextKey = iota
)

Variables

View Source
var (
	ErrWrongAuthSecretSize = errors.New("the session authentication key should have a size of 32 or 64 bytes")
	ErrWrongEncSecretSize  = errors.New("the session encryption key should have a size of 16, 24 or 32 bytes")
)
View Source
var (
	ErrCannotCreateCookie        = errors.New("cannot create a new cookie")
	ErrCannotGetCookie           = errors.New("cannot get the cookie")
	ErrSessionNotFound           = errors.New("cannot retrieve session from storage")
	ErrCannotRetrieveSessionData = errors.New("cannot retrieve session data")
	ErrSessionInvalid            = errors.New("cannot retrieve session id from memory")
)
View Source
var (
	ErrNilValue = errors.New("you cannot pass a nil value")
)

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	CookieName     string
	CookieDomain   string
	NewKeyPair     KeyPair
	OldKeyPair     KeyPair
	LoginTimeout   time.Duration
	SessionTimeout time.Duration
	SessionImpl    database.SessionImpl
}

type KeyPair

type KeyPair struct {
	Authentication string
	Encryption     string
}

type Manager

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

func NewManager

func NewManager(ctx context.Context, c Configuration) (*Manager, error)

func (*Manager) AuthenticationMiddleware

func (m *Manager) AuthenticationMiddleware(config *oidc.Config, next http.Handler) http.Handler

func (*Manager) CallbackHandlerOidc

func (m *Manager) CallbackHandlerOidc(config *oidc.Config, postLoginRedirectURI string) http.Handler

func (*Manager) GetSession

func (m *Manager) GetSession(r *http.Request, config *oidc.Config) (*Session, error)

func (*Manager) LoginHandlerOidc

func (m *Manager) LoginHandlerOidc(config *oidc.Config) http.Handler

func (*Manager) LogoutHandlerOidc

func (m *Manager) LogoutHandlerOidc(config *oidc.Config, postLogoutRedirectURI string) http.Handler

func (*Manager) NewSession

func (m *Manager) NewSession(r *http.Request, config *oidc.Config) (*Session, error)

func (*Manager) UserInfoHandlerOidc

func (m *Manager) UserInfoHandlerOidc(config *oidc.Config) http.Handler

func (*Manager) WaitSessionCleaner

func (m *Manager) WaitSessionCleaner(ctx context.Context)

type Session

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

func (*Session) Delete

func (s *Session) Delete(w http.ResponseWriter, r *http.Request) error

func (*Session) Save

func (s *Session) Save(w http.ResponseWriter, r *http.Request, token *oauth2.Token) error

func (*Session) Update

func (s *Session) Update(w http.ResponseWriter, r *http.Request, token *oauth2.Token) error

Jump to

Keyboard shortcuts

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