Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { CookieConfig // The name of the session. This is used as the name of the header when // HeaderMiddleware / HeaderLoginRequired is used, and as the name of the // cookie when CookieMiddleware / CookieLoginRequired is used. SessionName string MiddlewareType MiddlewareType Signer jwt.Signer Audience, Issuer, Subject string ExpireIn time.Duration }
Config is configuration model for ExtractToken
func New ¶
func New( sessionName string, middlewareType MiddlewareType, signer jwt.Signer, audience, issuer, subject string, expireIn time.Duration, cookieConf CookieConfig, ) (*Config, error)
New creates a new Config class safely. Note: If rxpireIn is 0, 3600 * time.Minute is used as a default-value.
type CookieConfig ¶
type CookieConfig struct {
Path, Domain string
Secure bool // <- Set true when using https.
HTTPOnly bool // <- Set false/zero-value when using with XHR.
SameSite http.SameSite
}
CookieConfig is used by Login function in the case of using cookie for session management.
type MiddlewareType ¶
type MiddlewareType int
MiddlewareType indicates the type of middleware to be used.
const ( // Cookie specifies cookie as the type of middleware. Cookie MiddlewareType = iota // Header specifies header as the type of middleware. Header )
Click to show internal directories.
Click to hide internal directories.