Documentation ¶
Index ¶
- Variables
- type Config
- type Session
- func (s *Session) Get(key string) interface{}
- func (s *Session) New(r *http.Request, config *Config) (*Session, error)
- func (s *Session) SID() string
- func (s *Session) Save(w http.ResponseWriter) error
- func (s *Session) Set(key string, val interface{})
- func (s *Session) SetCrypter(crypt crypt.CrypterI)
- func (s *Session) SetStore(store Store)
- type SessionI
- type Store
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrCipher = errors.New("simpa-sessions: SID is not signed by backend, but for compability created a new session")
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Name string `bson:"name" json:"name"` Value string `bson:"value" json:"value"` MaxAge int `bson:"maxage" json:"maxage"` Expires time.Time `bson:"expires" json:"expires"` Secure bool `bson:"secure" json:"secure"` HttpOnly bool `bson:"httponly" json:"httponly"` SameSite http.SameSite `bson:"samesite" json:"samesite"` }
Session Cookie cofig
type Session ¶
type Session struct { ID string `bson:"_id" json:"_id"` Values map[string]interface{} `bson:"values" json:"values"` // when marshaled should be encrypted through engine's crypter, when unmarshalled should decrypt and parse json Opts *Config `bson:"options" json:"options"` // contains filtered or unexported fields }
Session object
func (*Session) SetCrypter ¶
type SessionI ¶
type SessionI interface { // Creates or loads session from the database New(r *http.Request, config http.Cookie) (*Session, error) // saves session back to store Save() error // returns SID SID() string // sets key to map Set(key string, val interface{}) // gets ley from map Get(key string) interface{} // sets store driver SetStore(Store) // sets crypter, should set it from engine SetCrypter(crypt.CrypterI) // contains filtered or unexported methods }
Click to show internal directories.
Click to hide internal directories.