sessionmw

package
v0.0.0-...-83625b3 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MiddlewareDependencySession = "*sessionmw.SessionMiddleware"
)

Variables

This section is empty.

Functions

func GetSession

func GetSession(r *http.Request) session.Session

GetSession returns the session from the http request context.

Types

type Config

type Config struct {
	Key       string
	CookieURL string
}

type SessionIDStore

type SessionIDStore interface {
	SaveSessionID(sid, key string) error
	InvalidateSessionID(sid string) error
	InvalidateAll(key string) error
	GetIDs(key string) ([]string, error)
	Exists(sid string) (bool, error)
}

type SessionMiddleware

type SessionMiddleware struct {
	// contains filtered or unexported fields
}

func New

func New(prefix string, expiresAfter time.Duration) *SessionMiddleware

New creates a session middleware.

The prefix is an optional prefix for the cookie name. The cookie name after the prefix is "_SESSION". The key holds the secret key to sign and verify the cookies. The cookie URL determines the domain and the path parts of the HTTP cookie that will be set. It can be nil. If the cookie URL starts with https://, then the cookie will be forced to work only on HTTPS. The expiresAfter sets a duration for the cookies to expire.

func (*SessionMiddleware) ConfigSchema

func (s *SessionMiddleware) ConfigSchema() map[string]reflect.Type

func (*SessionMiddleware) Dependencies

func (s *SessionMiddleware) Dependencies() []string

func (*SessionMiddleware) Wrap

func (s *SessionMiddleware) Wrap(next http.Handler) http.Handler

Jump to

Keyboard shortcuts

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