Documentation
¶
Index ¶
- Variables
- type Server
- type Session
- func (session *Session) Authorize(salt string)
- func (session *Session) CreateCookie(salt string)
- func (session *Session) Destroy()
- func (session *Session) ID() string
- func (session *Session) IsAuth() bool
- func (session *Session) Unlink()
- func (session *Session) Valid(salt, userAgent, remoteAddr string) bool
Constants ¶
This section is empty.
Variables ¶
var DefaultHash = crypto.SHA1
DefaultHash is crypto hash used to makce session ID
var SessionCookieName = "sid"
SessionCookieName stores name of cookie used to link request with session data
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server interface { CookieValue(name string) (string, bool) SetCookieValue(name, value string) UserAgent() string RemoteAddr() string }
Server is interface/trates that should be implemented to use this package
type Session ¶
Session represents single session from one user across requests
func Validate ¶
Validate validates request for session storage returns session ID and true/false for if session found or not
func (*Session) Authorize ¶
Authorize marks session as authorized, you can pass sepecific value as "salt"/key. salt/key value should be used in validate call for new sessions ID generation, session id cookie is recreated with different ID to prevent session fixation attacks
func (*Session) CreateCookie ¶
CreateCookie will create cookie using salt/key
func (*Session) Destroy ¶
func (session *Session) Destroy()
Destroy destroys session data from session storage