session

package
v0.3.14 Latest Latest
Warning

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

Go to latest
Published: May 6, 2021 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AnonymousType = "session.type.anonymous"
)
View Source
var ErrSessionEmpty = errors.New("session empty")
View Source
var ErrSessionExpired = errors.New("session expired")
View Source
var ErrSessionRequired = errors.New("session required")

Functions

This section is empty.

Types

type ClientSession

type ClientSession struct {
	ID          string `json:"id,omitempty"`
	AccountID   int64  `json:"account_id,string,omitempty"`
	Type        string `json:"type"`
	AccountName string `json:"account_name,omitempty"`
	Name        string `json:"name,omitempty"`
	MaxAge      int    `json:"max_age"`
}

func (*ClientSession) ToCookie

func (cs *ClientSession) ToCookie(cookieName string, domain string) (*http.Cookie, error)

type Session

type Session struct {
	ClientSession
	CreatedAt time.Time `json:"created_at,omitempty"`
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	ExpiresAt time.Time `json:"expires_at,omitempty"`
}

로그인 세션

func FromCookie

func FromCookie(cookie *http.Cookie) (*Session, error)

func FromToken added in v0.2.13

func FromToken(token string) (*Session, error)

func Populate

func Populate(cs ClientSession) Session

func PopulateAnonymous

func PopulateAnonymous(maxAge int) (Session, error)

func (*Session) Extends added in v0.2.13

func (s *Session) Extends()

func (*Session) ToCookie

func (s *Session) ToCookie(httpCookieName string, cookieName string, domain string) (*http.Cookie, *http.Cookie, error)

func (*Session) ToHttpOnlyCookie

func (s *Session) ToHttpOnlyCookie(cookieName string) (*http.Cookie, error)

Jump to

Keyboard shortcuts

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