http

package
v0.0.0-...-9a8ef1a Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2018 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Length of the session token in bytes.
	TOKEN_SIZE = 64
)

Variables

View Source
var (
	ErrExpired      = errors.New("session is expired")
	ErrNoCookie     = errors.New("no session cookie")
	ErrInvalidToken = errors.New("invalid session token")
)

Functions

This section is empty.

Types

type SessionStore

type SessionStore struct {
	Sessions   map[string]*session
	CookieName string
	// contains filtered or unexported fields
}

func NewSessionStore

func NewSessionStore(cookie string) *SessionStore

Creates a new session store.

func (*SessionStore) Create

func (s *SessionStore) Create(timeout time.Duration) (string, error)

Creates a new session with the given expiration time.

func (*SessionStore) Delete

func (s *SessionStore) Delete(token string)

Deletes a session form the session store.

func (*SessionStore) Refresh

func (s *SessionStore) Refresh(token string)

Refreshs the given session.

func (*SessionStore) ValidateRequest

func (s *SessionStore) ValidateRequest(r *http.Request) (string, error)

Checks if the given token belongs to a valid session.

Jump to

Keyboard shortcuts

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