sessions

package
v4.2.2 Latest Latest
Warning

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

Go to latest
Published: May 11, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SessionState

type SessionState struct {
	AccessToken  string    `json:",omitempty"`
	IDToken      string    `json:",omitempty"`
	CreatedAt    time.Time `json:"-"`
	ExpiresOn    time.Time `json:"-"`
	RefreshToken string    `json:",omitempty"`
	Email        string    `json:",omitempty"`
	User         string    `json:",omitempty"`
}

SessionState is used to store information about the currently authenticated user session

func DecodeSessionState

func DecodeSessionState(v string, c *encryption.Cipher) (*SessionState, error)

DecodeSessionState decodes the session cookie string into a SessionState

func (*SessionState) Age

func (s *SessionState) Age() time.Duration

Age returns the age of a session

func (*SessionState) EncodeSessionState

func (s *SessionState) EncodeSessionState(c *encryption.Cipher) (string, error)

EncodeSessionState returns string representation of the current session

func (*SessionState) IsExpired

func (s *SessionState) IsExpired() bool

IsExpired checks whether the session has expired

func (*SessionState) String

func (s *SessionState) String() string

String constructs a summary of the session state

type SessionStateJSON

type SessionStateJSON struct {
	*SessionState
	CreatedAt *time.Time `json:",omitempty"`
	ExpiresOn *time.Time `json:",omitempty"`
}

SessionStateJSON is used to encode SessionState into JSON without exposing time.Time zero value

type SessionStore

type SessionStore interface {
	Save(rw http.ResponseWriter, req *http.Request, s *SessionState) error
	Load(req *http.Request) (*SessionState, error)
	Clear(rw http.ResponseWriter, req *http.Request) error
}

SessionStore is an interface to storing user sessions in the proxy

Jump to

Keyboard shortcuts

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