Documentation
¶
Overview ¶
Package jojo implements session interfaces for jwt tokens for long-season application.
Index ¶
- type JWT
- func (j *JWT) Kill(_ context.Context, w http.ResponseWriter) error
- func (j *JWT) RenewFromCookies() RenewStrategy
- func (j *JWT) RenewFromHeaderToken(header, prefix string) RenewStrategy
- func (j *JWT) Save(ctx context.Context, w http.ResponseWriter, s session.State) error
- func (j *JWT) Tokenize(ctx context.Context, s session.State) (string, error)
- type RenewStrategy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JWT ¶
type JWT struct { // Secret is jwt secret. The longer secret is, the better. Secret []byte // Algorithm is JWT algorithm used for signing Algorithm jwt.Algorithm // AppName is issuer application name. AppName string // CookieKey is key used to store API token in cookies. CookieKey string }
JWT implements session's interfaces for stateless session management.
func (*JWT) RenewFromCookies ¶
func (j *JWT) RenewFromCookies() RenewStrategy
RenewFromCookies returns Renewer for retrieving session from http cookies.
func (*JWT) RenewFromHeaderToken ¶
func (j *JWT) RenewFromHeaderToken(header, prefix string) RenewStrategy
RenewFromHeaderToken returns Renewer for retrieving session from given header with given prefix. For example for header equal to "Authorization" and prefix equal to "Bearer" returned RenewStrategy will retrieve JWT token from "Authorization" header in the form of "Bearer $TOKEN" where "$TOKEN" is tokenized JWT session State.
type RenewStrategy ¶
RenewStrategy is functional implementation of session's Renewer interface.