session

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const COOKIE_NAME = "happydomain_session"

Variables

This section is empty.

Functions

This section is empty.

Types

type SessionStore

type SessionStore struct {
	Codecs []securecookie.Codec
	// contains filtered or unexported fields
}

SessionStore is an implementation of Gorilla Sessions, using happyDomain storage.

func NewSessionStore

func NewSessionStore(opts *happydns.Options, storage sessionUC.SessionStorage, keyPairs ...[]byte) *SessionStore

func (*SessionStore) Get

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

Get Fetches a session for a given name after it has been added to the registry.

func (*SessionStore) MaxAge

func (s *SessionStore) MaxAge(age int)

MaxAge sets the maximum age for the store and the underlying cookie implementation. Individual sessions can be deleted by setting Options.MaxAge = -1 for that session.

func (*SessionStore) New

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

New returns a new session for the given name without adding it to the registry.

func (*SessionStore) Options

func (s *SessionStore) Options(options ginsessions.Options)

func (*SessionStore) Save

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

Save saves the given session into the database and deletes cookies if needed.

Source Files

  • sessions.go

Jump to

Keyboard shortcuts

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