store

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2023 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCookie

func GetCookie(r *http.Request, cookieName string) (*http.Cookie, error)

func GetSession

func GetSession(r *http.Request, cookieName string, sessionStore SessionStore) (*sessions.Session, error)

func RemoveCookie

func RemoveCookie(w http.ResponseWriter, cookieName string, v Config)

func RemoveSession

func RemoveSession(r *http.Request, w http.ResponseWriter, cookieName string, sessionStore SessionStore) error

func SetCookie

func SetCookie(w http.ResponseWriter, value string, cookieName string, v Config)

func SetCookieB64

func SetCookieB64(w http.ResponseWriter, body []byte, cookieName string, v Config) string

func SetSession

func SetSession(r *http.Request, w http.ResponseWriter, value, cookieName, valueName string, sessionStore SessionStore) error

func SetSessionB64

func SetSessionB64(r *http.Request, w http.ResponseWriter, body []byte, cookieName, valueName string, sessionStore SessionStore) (string, error)

Types

type Config

type Config struct {
	Domain string `cfg:"domain"`
	Path   string `cfg:"path"`
	MaxAge int    `cfg:"max_age"`
	Secure bool   `cfg:"secure"`
}

type OptionsParse

type OptionsParse func(*optionsParse)

func WithBase64

func WithBase64(v bool) OptionsParse

type SessionStore

type SessionStore interface {
	Get(r *http.Request, name string) (*sessions.Session, error)
}

type Token

type Token struct {
	AccessToken      string `json:"access_token"`
	ExpiresIn        int    `json:"expires_in"`
	RefreshExpiresIn int    `json:"refresh_expires_in"`
	RefreshToken     string `json:"refresh_token"`
	TokenType        string `json:"token_type"`
	NotBeforePolicy  int    `json:"not-before-policy"`
	SessionState     string `json:"session_state"`
	Scope            string `json:"scope"`
}

func Parse

func Parse(v string, opts ...OptionsParse) (*Token, error)

Jump to

Keyboard shortcuts

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