Documentation
¶
Index ¶
- Variables
- func CORS(origin, credentials, headers, methods, maxAge string) gin.HandlerFunc
- func Firewall(listType string, ipList string) gin.HandlerFunc
- func GetJWT(id uint64, email, role, scope, siteLan, custom1, custom2, tokenType string) (string, string, error)
- func JWT() gin.HandlerFunc
- func Pongo2(baseDirectory string) gin.HandlerFunc
- func RefreshJWT() gin.HandlerFunc
- func SentryCapture(sentryDsn string) gin.HandlerFunc
- type JWTClaims
- type JWTPayload
Constants ¶
This section is empty.
Variables ¶
var ( AccessKey []byte AccessKeyTTL int RefreshKey []byte RefreshKeyTTL int Audience string Issuer string AccNbf int RefNbf int Subject string )
variables for issuing or validating tokens
var ( AuthID uint64 Email string Role string Scope string SiteLan string Custom1 string Custom2 string )
user-related info for JWT
Functions ¶
func CORS ¶
func CORS(origin, credentials, headers, methods, maxAge string) gin.HandlerFunc
CORS - Cross-Origin Resource Sharing origin: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin credentials: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Credentials headers: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Headers methods: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Methods maxAge: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Max-Age General recommendation for dev environment: ---------------------------------- origin: "*" credentials: "true" headers: "Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, accept, origin, Cache-Control, X-Requested-With" methods: "GET, POST, PUT, PATCH, DELETE" maxAge: 300
func Firewall ¶
func Firewall(listType string, ipList string) gin.HandlerFunc
Firewall - whitelist/blacklist IPs
func GetJWT ¶
func GetJWT(id uint64, email, role, scope, siteLan, custom1, custom2, tokenType string) (string, string, error)
GetJWT - issue new tokens
func Pongo2 ¶
func Pongo2(baseDirectory string) gin.HandlerFunc
Pongo2 - uses the Pongo2 template library https://github.com/flosch/pongo2 to render templates Example: baseDirectory = "templates/"
func SentryCapture ¶
func SentryCapture(sentryDsn string) gin.HandlerFunc
SentryCapture - capture errors and forward to sentry.io
Types ¶
type JWTClaims ¶ added in v0.0.3
type JWTClaims struct { jwt.StandardClaims // contains filtered or unexported fields }
JWTClaims ...
type JWTPayload ¶
type JWTPayload struct { AccessJWT string `json:"accessJWT,omitempty"` RefreshJWT string `json:"refreshJWT,omitempty"` }
JWTPayload ...