dynamostore

package
v0.0.0-...-902e302 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2017 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// SessionIdHashKeyName is the name of attribute that represents session id.
	SessionIdHashKeyName = "session_id"

	// SessionDataKeyName is the name of attribute that represents session data encoded in Gob.
	SessionDataKeyName = "session_data"

	// SessionExpiresName is the name of attribute that represents session expiration date.
	SessionExpiresName = "session_expires_at"
)
View Source
var DefaultSessionOpts = &sessions.Options{
	Path:   "/",
	MaxAge: 86400 * 30,
}

Functions

This section is empty.

Types

type Store

type Store struct {
	Table  *table.Table
	Codecs []securecookie.Codec

	// Options is served as the default configuration for Cookie
	Options *sessions.Options

	// If UseSessionCookie is true, a cookie will not have Expires and Max-Age fields.
	// Otherwise, it will be set to the same value of Options.MaxAge.
	UseSessionCookie bool
}

Store represents the session store backed by DynamoDB.

func New

func New(dynamodbAPI dynamodbiface.DynamoDBAPI, tableName string, keyPairs ...[]byte) *Store

New returns a new session store. See https://github.com/gorilla/sessions/blob/master/store.go for what keyPairs means. Especially for dynamostore, keyPairs is be used to authenticate session id. Yes, the actual data is stored in DynamoDB table.

func (*Store) Get

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

Get returns a session for the given name after adding it to the registry.

See gorilla/sessions FilesystemStore.Get(). or boj/redistore

func (*Store) MaxAge

func (s *Store) 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 (*Store) New

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

func (*Store) Save

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

Save adds a single session to the response.

Jump to

Keyboard shortcuts

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