cookie

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AccessTokenCookieName  = "cshtrka"
	RefreshTokenCookieName = "cshtrkr"
)
View Source
const (
	CsrfTokenCookieName = "cshtrkcsrf"
	CsrfTokenTtl        = time.Minute * 10
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	AccessToken           string `json:"accessToken,omitempty"`
	AccessTokenExpiredAt  string `json:"accessTokenExpiredAt,omitempty"`
	RefreshToken          string `json:"refreshToken,omitempty"`
	RefreshTokenExpiredAt string `json:"refreshTokenExpiredAt,omitempty"`
}

func ReadAuthCookie

func ReadAuthCookie(ctx *fasthttp.RequestCtx) Auth

func (Auth) CanRefresh

func (a Auth) CanRefresh() bool

func (Auth) GetRefreshTokenExpireDate

func (a Auth) GetRefreshTokenExpireDate() time.Time

func (Auth) IsLogged

func (a Auth) IsLogged() bool

func (Auth) WriteCookie

func (a Auth) WriteCookie(ctx *fasthttp.RequestCtx)

type CSRF added in v1.2.0

type CSRF struct {
	Auth  Auth
	Token string
}

func ReadCSRFCookie added in v1.2.0

func ReadCSRFCookie(ctx *fasthttp.RequestCtx) CSRF

func (CSRF) WriteCookie added in v1.2.0

func (c CSRF) WriteCookie(ctx *fasthttp.RequestCtx)

Jump to

Keyboard shortcuts

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