sessionstore

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ProtobufEncoder

type ProtobufEncoder struct{}

ProtobufEncoder is a securecookie.Serializer that deals with protobuf messages.

func (*ProtobufEncoder) Deserialize

func (p *ProtobufEncoder) Deserialize(src []byte, dst interface{}) error

func (*ProtobufEncoder) Serialize

func (p *ProtobufEncoder) Serialize(src interface{}) ([]byte, error)

type Store

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

A SessionStore is a slightly simpler version of gorilla sessions.Store, without the global session registry, serializing specific types rather than generic interfaces. Each Store manages a single session cookie.

func New

func New(name, path string, authKey, encKey []byte, maxAge int) *Store

func NewProtobuf

func NewProtobuf(name, path string, authKey, encKey []byte, maxAge int) *Store

NewProtobuf returns a new Store with protobuf encoder.

func (*Store) Delete

func (s *Store) Delete(w http.ResponseWriter) error

Delete the current session cookie.

func (*Store) Get

func (s *Store) Get(req *http.Request, obj interface{}) error

Get decodes the current session, if any, into 'obj'.

func (*Store) Set

func (s *Store) Set(w http.ResponseWriter, obj interface{}) error

Set the session value.

func (*Store) WithSecure

func (s *Store) WithSecure(secure bool) *Store

WithSecure allows to explicitly toggle the 'Secure' bit on cookies.

func (*Store) WithSerializer

func (s *Store) WithSerializer(serializer securecookie.Serializer) *Store

WithSerializer allows changing the default JSON serializer.

Jump to

Keyboard shortcuts

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