store

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store interface {
	CreateSession(gc *gin.Context, userInfo *UserInfo, accessToken string) error
	GetSession(gc *gin.Context, accessToken string) (*UserSession, error)
	DeleteSession(gc *gin.Context, accessToken string) error
}

func NewStore

func NewStore(sessionMaxSeconds int64) Store

Instanciate a store

sessionMaxSeconds is the maximum length of a user session, in seconds

type UserInfo

type UserInfo struct {
	Sub       string `json:"sub"`
	FirstName string `json:"firstname"`
	Surname   string `json:"surname"`
	Email     string `json:"email"`
}

UserInfo is the response structure of a GetUserInfo operation

type UserSession

type UserSession struct {
	UserInfo  UserInfo  `json:"user_info"`
	StartedAt time.Time `json:"started_at"`
	ExpireAt  time.Time `json:"expire_at"`
}

func NewUserSession

func NewUserSession(userInfo UserInfo, validity time.Duration) *UserSession

func (*UserSession) IsExpired

func (us *UserSession) IsExpired() bool

Jump to

Keyboard shortcuts

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