Back to godoc.org

Package session

v0.0.0-...-3e1c22f
Latest Go to latest

The highest tagged major version is .

Published: Oct 2, 2019 | License: GPL2 | Module: github.com/tribehq/platform

Index

Variables

var (
	// StorageSessionName ...
	StorageSessionName = "oauth2_server_session"
	// UserSessionKey ...
	UserSessionKey = "oauth2_server_user"
	// ErrSessonNotStarted ...
	ErrSessonNotStarted = errors.New("session not started")
)

type Service

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

Service wraps session functionality

func NewService

func NewService(sessionStore sessions.Store) *Service

NewService returns a new Service instance

func (*Service) ClearUserSession

func (s *Service) ClearUserSession() error

ClearUserSession deletes the user session

func (*Service) GetFlashMessage

func (s *Service) GetFlashMessage() (interface{}, error)

GetFlashMessage returns the first flash message

func (*Service) GetUserSession

func (s *Service) GetUserSession() (*UserSession, error)

GetUserSession returns the user session

func (*Service) SetFlashMessage

func (s *Service) SetFlashMessage(msg string) error

SetFlashMessage sets a flash message, useful for displaying an error after 302 redirection

func (*Service) SetSessionSave

func (s *Service) SetSessionSave(ctx echo.Context) error

SetSessionSave saves to the session

func (*Service) SetSessionService

func (s *Service) SetSessionService(ctx echo.Context)

SetSessionService sets the request and responseWriter on the session service

func (*Service) SetUserSession

func (s *Service) SetUserSession(userSession *UserSession) error

SetUserSession saves the user session

func (*Service) StartSession

func (s *Service) StartSession() error

StartSession starts a new session. This method must be called before other public methods of this struct as it sets the internal session object

type UserSession

type UserSession struct {
	ClientID     string
	UserID       string
	AccessToken  string
	RefreshToken string
}

UserSession has user data stored in a session after logging in

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier