filters

package
v0.0.0-...-c937b9e Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2015 License: MIT Imports: 13 Imported by: 30

Documentation

Index

Constants

View Source
const (
	SessionUserKey = "__user"
	AttrUserKey    = "__user"
)

Variables

View Source
var AttrSessionKey = "__session"

name for key in restful attributes

Functions

func AuthRequiredFilter

func AuthRequiredFilter(mgr *manager.Manager) restful.FilterFunction

func AuthTokenFilter

func AuthTokenFilter(mgr *manager.Manager) restful.FilterFunction

func GetUser

func GetUser(req *restful.Request) *user.User

Get user from restful.Request attribute or panic

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) Del

func (s *Session) Del(key string)

func (*Session) Get

func (s *Session) Get(key string) (string, bool)

func (*Session) IsModified

func (s *Session) IsModified() bool

func (*Session) Set

func (s *Session) Set(key, val string)

Jump to

Keyboard shortcuts

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