Documentation
¶
Index ¶
- Variables
- func Env()
- func JWTNewAccessCookie(token *vmod.JWTToken) *http.Cookie
- func JWTNewRefreshCookie(token *vmod.JWTToken) *http.Cookie
- func JWTUser(c echo.Context) (u *vmod.User)
- func NewCORSConfig() middleware.CORSConfig
- func SessionLoadEnv()
- func SessionWithID(next echo.HandlerFunc) echo.HandlerFunc
- type JWTMiddleware
- type LoadEnv
- func (l LoadEnv) GetEnvBool(key string, lvl string, dVal bool) (bool, LoadEnv)
- func (l LoadEnv) GetEnvInt(key string, lvl string, dVal int) (int, LoadEnv)
- func (l LoadEnv) GetEnvString(key string, lvl string, dVal string) (string, LoadEnv)
- func (l LoadEnv) GetEnvStringList(key string, lvl string, dVal []string) ([]string, LoadEnv)
- func (l LoadEnv) Validate()
Constants ¶
This section is empty.
Variables ¶
var AccessCookieConfig = middleware.JWTConfig{ Claims: &vmod.AccessToken{}, ContextKey: "token", TokenLookup: "cookie:access_token", SigningKey: []byte(os.Getenv("JWT_SECRET")), }
AccessCookieConfig can with echo for middleware.JWTWithConfig(vmod.AccessConfig) to handling access controll The token is reachable with c.Get("token")
var HTTPBaseCookie http.Cookie
HTTPBaseCookie defines the base cookie setup for vcago
var RefreshCookieConfig = middleware.JWTConfig{ Claims: &vmod.RefreshToken{}, ContextKey: "token", TokenLookup: "cookie:refresh_token", SigningKey: []byte(os.Getenv("JWT_SECRET")), }
RefreshCookieConfig can with echo for middleware.JWTWithConfig(vmod.AccessConfig) to handling access controll The token is reachable with c.Get("token")
var SessionOptions = new(sessions.Options)
SessionOptions used for user session
Functions ¶
func JWTNewAccessCookie ¶ added in v0.1.6
JWTNewAccessCookie create a new http.Cookie contains the access_token.
func JWTNewRefreshCookie ¶ added in v0.1.6
JWTNewRefreshCookie create a new http.Cookie contains the refresh_token.
func NewCORSConfig ¶ added in v0.1.0
func NewCORSConfig() middleware.CORSConfig
NewCORSConfig create a echo middleware for cors handling.
func SessionWithID ¶ added in v0.1.1
func SessionWithID(next echo.HandlerFunc) echo.HandlerFunc
SessionWithID return session wir id
Types ¶
type JWTMiddleware ¶ added in v0.1.6
type JWTMiddleware struct { RequestCount uint64 `json:"request_count"` Scope string `json:"scope"` }
JWTMiddleware handles authentication by jwt
type LoadEnv ¶ added in v0.1.1
type LoadEnv []bool
LoadEnv used for loading environment variables.
func (LoadEnv) GetEnvBool ¶ added in v0.1.1
GetEnvBool load a key from environment variables as bool.
func (LoadEnv) GetEnvInt ¶ added in v0.1.1
GetEnvInt loads a key from enviroment variables as int. The lvl param defines the log level. For warnings set "w" and for error set "e". If the variable is not used or can be ignored use n for do nothing. The default value can be set by the dVal param.
func (LoadEnv) GetEnvString ¶ added in v0.1.1
GetEnvString loads a key from enviroment variables as string. The lvl param defines the log level. For warnings set "w" and for error set "e". If the variable is not used or can be ignored use n for do nothing. The default value can be set by the dVal param.
func (LoadEnv) GetEnvStringList ¶ added in v0.1.1
GetEnvStringList as