Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                

session

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package session provides typed, nil-safe accessors for the values the framework stores on a github.com/gorilla/sessions.Session, plus a helper to obtain the session's github.com/mikehelmick/go-bananas/flash.Flash.

Storing values through these helpers keeps key names and value types consistent between the middleware that writes them and the handlers that read them. Every accessor tolerates a nil session.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CSRFToken

func CSRFToken(session *sessions.Session) []byte

CSRFToken returns the CSRF token stored on the session, or nil if absent or malformed (in which case it is also cleared).

func ClearCSRFToken

func ClearCSRFToken(session *sessions.Session)

ClearCSRFToken removes the CSRF token from the session.

func ClearLastActivity

func ClearLastActivity(session *sessions.Session)

ClearLastActivity removes the last-activity time from the session.

func ClearNonce

func ClearNonce(session *sessions.Session)

ClearNonce removes the nonce from the session.

func ClearRegion

func ClearRegion(session *sessions.Session)

ClearRegion removes the region from the session.

func Flash

func Flash(session *sessions.Session) *flash.Flash

Flash returns the flash.Flash for the provided session, initializing the session's value map if necessary. It tolerates a nil session.

func LastActivity

func LastActivity(session *sessions.Session) time.Time

LastActivity returns the time of the user's last activity, or the zero time if absent or malformed (in which case it is also cleared).

func Nonce

func Nonce(session *sessions.Session) string

Nonce returns the current nonce from the session, or "" if absent or malformed.

func Region

func Region(session *sessions.Session) string

Region returns the current region from the session, or "" if absent or malformed.

func StoreCSRFToken

func StoreCSRFToken(session *sessions.Session, token []byte)

StoreCSRFToken stores the CSRF token on the session. A nil session or zero-length token is a no-op.

func StoreLastActivity

func StoreLastActivity(session *sessions.Session, t time.Time)

StoreLastActivity stores the time of the user's last activity, used to track idle session timeouts. A nil session is a no-op.

func StoreNonce

func StoreNonce(session *sessions.Session, nonce string)

StoreNonce stores the session's current nonce value. A nil session is a no-op.

func StoreRegion

func StoreRegion(session *sessions.Session, region string)

StoreRegion stores the current operating region in the session. A nil session is a no-op.

Types

This section is empty.

Jump to

Keyboard shortcuts

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