Documentation ¶
Index ¶
- Constants
- Variables
- func AuthRequiredFilter(mgr *manager.Manager) restful.FilterFunction
- func AuthTokenFilter(mgr *manager.Manager) restful.FilterFunction
- func GetUser(req *restful.Request) *user.User
- func NewCookie(name, value string, options *CookieOpts) *http.Cookie
- func SessionCookieFilter(cookieName string, opts *CookieOpts, keyPairs ...string) restful.FilterFunction
- func SessionFilterMock(session *Session) restful.FilterFunction
- type CookieOpts
- type Session
Constants ¶
View Source
const ( SessionUserKey = "__user" AttrUserKey = "__user" )
Variables ¶
View Source
var AttrSessionKey = "__session"
name for key in restful attributes
Functions ¶
func AuthRequiredFilter ¶
func AuthTokenFilter ¶
func NewCookie ¶
func NewCookie(name, value string, options *CookieOpts) *http.Cookie
NewCookie returns an http.Cookie with the options set. It also sets the Expires field calculated based on the MaxAge value, for Internet Explorer compatibility.
func SessionCookieFilter ¶
func SessionCookieFilter(cookieName string, opts *CookieOpts, keyPairs ...string) restful.FilterFunction
func SessionFilterMock ¶
func SessionFilterMock(session *Session) restful.FilterFunction
Types ¶
type CookieOpts ¶
type CookieOpts struct { Path string Domain string // MaxAge=0 means no 'Max-Age' attribute specified. // MaxAge<0 means delete cookie now, equivalently 'Max-Age: 0'. // MaxAge>0 means Max-Age attribute present and given in seconds. MaxAge int Secure bool HttpOnly bool }
Options stores configuration for a session or session store.
Fields are a subset of http.Cookie fields.
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
func GetSession ¶
func GetSession(req *restful.Request) *Session
Get session from restful.Request attribute or panic
func NewSession ¶
func NewSession() *Session
func (*Session) IsModified ¶
Click to show internal directories.
Click to hide internal directories.