gorilla

package
v0.0.0-...-6b2826c Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: AGPL-3.0 Imports: 8 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateCookieSessionStore

func CreateCookieSessionStore(authKeySize, encryptKeySize int, defaultOptions *sessions.Options) (sessions.Store, error)

CreateCookieSessionStore creates and returns a new cookie session store with random authentication and encryption keys

func GenerateRandomBytes

func GenerateRandomBytes(n int) ([]byte, error)

func ServiceProvider

func ServiceProvider(sessionName string, store sessions.Store) service.Provider

ServiceProvider returns a service.Provider for the the gorilla session service implementation

Types

type Session

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

Session is an implementation of the session.Session service backed by github.com/gorilla/sessions Session

func NewSession

func NewSession(sess *sessions.Session) *Session

NewSession returns a new Session

func (*Session) AddFlash

func (s *Session) AddFlash(flashType session.FlashType, message string)

AddFlash adds the given flash message to the stack

func (*Session) Delete

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

Delete deletes the session

func (*Session) Flashes

func (s *Session) Flashes(flashTypes ...session.FlashType) []session.Flash

Flashes retrieves the flash messages of the given types in the stack

func (*Session) Get

func (s *Session) Get(key string) interface{}

Get retrieve a value from the session

func (*Session) Save

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

Save saves the session with its current values

func (*Session) Set

func (s *Session) Set(key string, value interface{})

Set updates a value in the session

func (*Session) Unset

func (s *Session) Unset(key string)

Unset remove a value in the session

type SessionService

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

SessionService is an implementation of service.Session based on the github.com/gorilla/sessions

func NewSessionService

func NewSessionService(sessionName string, store sessions.Store) *SessionService

NewSessionService returns a new SessionService backed by the given Store

func (*SessionService) Get

Get returns a Session associated with the given HTTP request

Jump to

Keyboard shortcuts

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