Documentation ¶
Index ¶
- type DynamoDBStore
- func (s *DynamoDBStore) Get(r *http.Request, name string) (*sessions.Session, error)
- func (s *DynamoDBStore) New(r *http.Request, name string) (*sessions.Session, error)
- func (s *DynamoDBStore) Save(r *http.Request, w http.ResponseWriter, session *sessions.Session) error
- func (s *DynamoDBStore) SetMaxAge(v int)
- func (s *DynamoDBStore) SetSerializer(ss SessionSerializer)
- type GobSerializer
- type SessionSerializer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DynamoDBStore ¶
type DynamoDBStore struct { Db *dynamodb.DynamoDB Table string Codecs []securecookie.Codec Options *sessions.Options // default configuration DefaultMaxAge int // default TTL for a MaxAge == 0 session // contains filtered or unexported fields }
DynamoDBStore stores sessions in a DynamoDB table.
func NewDynamoDBStore ¶
func NewDynamoDBStore(db *dynamodb.DynamoDB, sessionCookieExpireTime int, sessionTableName string, readCapacityUnits int64, writeCapacityUnits int64, keyPairs ...[]byte) (*DynamoDBStore, error)
NewDynamoDBStore returns a new DynamoDBStore. sessionCookieExpireTime controls how long a session will live in the database when it is set to 0 seconds expire time aka session cookie sessionTableName is name of dynamodb table to use - is created if it does not exist. If created, readCapacityUnits and writeCapacityUnits are used
func (*DynamoDBStore) Get ¶
Get returns a session for the given name after adding it to the registry.
See gorilla/sessions FilesystemStore.Get().
func (*DynamoDBStore) New ¶
New returns a session for the given name without adding it to the registry.
See gorilla/sessions FilesystemStore.New().
func (*DynamoDBStore) Save ¶
func (s *DynamoDBStore) Save(r *http.Request, w http.ResponseWriter, session *sessions.Session) error
Save adds a single session to the response.
func (*DynamoDBStore) SetMaxAge ¶
func (s *DynamoDBStore) SetMaxAge(v int)
SetMaxAge restricts the maximum age, in seconds, of the session record both in database and a browser. This is to change session storage configuration. If you want just to remove session use your session `s` object and change it's `Options.MaxAge` to -1, as specified in
http://godoc.org/github.com/gorilla/sessions#Options
Default is the one provided by this package value - `sessionExpire`. Set it to 0 for no restriction. Because we use `MaxAge` also in SecureCookie crypting algorithm you should use this function to change `MaxAge` value.
func (*DynamoDBStore) SetSerializer ¶
func (s *DynamoDBStore) SetSerializer(ss SessionSerializer)
SetSerializer sets the serializer
type GobSerializer ¶
type GobSerializer struct{}
GobSerializer uses gob package to encode the session map
func (GobSerializer) Deserialize ¶
func (s GobSerializer) Deserialize(d []byte, ss *sessions.Session) error
Deserialize back to map[interface{}]interface{}