Help us shape the future of Go! Take the 2026 Go Developer Survey

session

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2021 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ApiKeyHeader    = "ApiKey"
	ApiKeyParameter = "apikey"
)

Variables

View Source
var ErrInvalidCredentials = errors.New("invalid username or password")
View Source
var ErrUnauthorized = errors.New("unauthorized")

Functions

func AddVisitedPlugin

func AddVisitedPlugin(ctx context.Context, pluginID string) context.Context

func GetCurrentUserID

func GetCurrentUserID(ctx context.Context) *string

GetCurrentUserID gets the current user id from the provided context

func GetVisitedPlugins

func GetVisitedPlugins(ctx context.Context) []string

func SetCurrentUserID

func SetCurrentUserID(ctx context.Context, userID string) context.Context

Types

type Store

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

func NewStore

func NewStore(c *config.Instance) *Store

func (*Store) Authenticate

func (s *Store) Authenticate(w http.ResponseWriter, r *http.Request) (userID string, err error)

func (*Store) GetSessionUserID

func (s *Store) GetSessionUserID(w http.ResponseWriter, r *http.Request) (string, error)

func (*Store) Login

func (s *Store) Login(w http.ResponseWriter, r *http.Request) error

func (*Store) Logout

func (s *Store) Logout(w http.ResponseWriter, r *http.Request) error

func (*Store) MakePluginCookie

func (s *Store) MakePluginCookie(ctx context.Context) *http.Cookie

func (*Store) VisitedPluginHandler

func (s *Store) VisitedPluginHandler() func(http.Handler) http.Handler

Jump to

Keyboard shortcuts

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