transport

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2020 License: MIT Imports: 4 Imported by: 5

Documentation

Index

Constants

View Source
const (
	// DefaultCookieName is the default cookie name used
	DefaultCookieName = "session"
	// DefaultCookiePath is the default cookie path
	DefaultCookiePath = "/"
)

Variables

View Source
var ErrNoSessionOnRequest = errors.New("no session on request")

ErrNoSessionOnRequest is thrown when a session is not found on a request

Functions

This section is empty.

Types

type Options

type Options struct {
	CookieName string
	CookiePath string
	HTTPOnly   bool
	Secure     bool
}

Options defines the behavior of the transport service

type Service

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

Service writes sessions on responseWriters and reads sessions from requests

func New

func New(options Options) *Service

New returns a new transport service

func (*Service) DeleteSessionFromResponse

func (s *Service) DeleteSessionFromResponse(w http.ResponseWriter) error

DeleteSessionFromResponse deletes a user session from a responseWriter

func (*Service) FetchSessionIDFromRequest

func (s *Service) FetchSessionIDFromRequest(r *http.Request) (string, error)

FetchSessionIDFromRequest retrieves a signed session id from a request

func (*Service) SetSessionOnResponse

func (s *Service) SetSessionOnResponse(signedSessionID string, userSession *user.Session, w http.ResponseWriter) error

SetSessionOnResponse sets a signed session id and a user session on a responseWriter

type ServiceInterface

type ServiceInterface interface {
	SetSessionOnResponse(session string, userSession *user.Session, w http.ResponseWriter) error
	DeleteSessionFromResponse(w http.ResponseWriter) error
	FetchSessionIDFromRequest(r *http.Request) (string, error)
}

ServiceInterface defines the methods performed by the transport service

Jump to

Keyboard shortcuts

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