session

package
v0.0.0-...-d22e7c3 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2020 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultSessionExpiryTime = time.Hour * 24 * 15
)

expiry time list

Variables

View Source
var (
	ErrSessionNotFound error = errors.New("session: not found")
)

list of error

Functions

func WithSession

func WithSession(ctx context.Context, sess *Session) context.Context

WithSession return a context with appended session data

Types

type AuthData

type AuthData struct {
	Provider authentity.Provider `json:"provider"`
	Action   authentity.Action   `json:"action"`
}

AuthData struct

type Session

type Session struct {
	ID            string        `json:"id"`
	HashID        string        `json:"hash_id"`
	AuthData      AuthData      `json:"auth_data"`
	Authenticated bool          `json:"authenticated"`
	ExpiryTime    time.Duration `json:"expiry_time"`
	ExpiredAt     time.Time     `json:"expired_at"`
	CreatedAt     time.Time     `json:"created_at"`
}

Session struct

func FromContext

func FromContext(ctx context.Context) *Session

FromContext return a session instance from requestContext

type UserData

type UserData struct {
	User userentity.User `json:"user"`
	Bio  userentity.Bio  `json:"bio"`
}

UserData session is a user data cache that assosiated to session of user

Jump to

Keyboard shortcuts

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