Documentation ¶
Index ¶
- Constants
- func JWTAuthenticator(next http.Handler) http.Handler
- func JWTParse(token, key string) (*jwt.Token, error)
- func JWTVerify(ja *jwtauth.JWTAuth, injectJWTCookie bool, cookieOpts *sessions.Options, ...) func(http.Handler) http.Handler
- func NewSignedJWT(key, user string) (string, jwt.MapClaims, error)
- func RequestCtxAuthed(r *http.Request) bool
- func RequestCtxAuthzed(r *http.Request) bool
- func RequestCtxJWTSession(r *http.Request) *sessions.Session
- func RequestCtxSession(r *http.Request) *sessions.Session
- func RequestCtxToken(r *http.Request) string
- func RequestCtxUser(r *http.Request) string
- func UseLog(_log *logrus.Logger)
Constants ¶
const ( CtxToken contextKey = iota CtxUser CtxAuthed CtxAuthzed CtxSession CtxJWTCookie )
Variables ¶
This section is empty.
Functions ¶
func JWTAuthenticator ¶
JWTAuthenticator allows handers to proceed given a validated token identified via jwtauth.FromContext. This should be used after jwtauth.Verify/Verifier.
func JWTVerify ¶
func JWTVerify(ja *jwtauth.JWTAuth, injectJWTCookie bool, cookieOpts *sessions.Options, findTokenFns ...func(r *http.Request) string) func(http.Handler) http.Handler
JWTVerify middleware verifies a JWT from sources defined via the findTokenFns functions. If the jwtauth verification has already been successfully performed for this request, the verifications functions are not run. If injectJWTCookie is true, any located token will be injected as a request cookie, "jwt" so that the session cookie middleware may reuse it. If not injecting a cookie into the request, cookieOpts may be nil.
func NewSignedJWT ¶
NewSignedJWT generates a new JWT, signs the input key and returns the result along with the claims map and an error value.
func RequestCtxAuthed ¶
RequestCtxAuthed extracts the CtxAuthed value from the request context.
func RequestCtxAuthzed ¶
RequestCtxAuthzed extracts the CtxAuthzed value from the request context.
func RequestCtxJWTSession ¶
RequestCtxJWTSession extracts the CtxJWTCookie value from the request context.
func RequestCtxSession ¶
RequestCtxSession extracts the CtxSession value from the request context.
func RequestCtxToken ¶
RequestCtxToken extracts the CtxToken value from the request context.
func RequestCtxUser ¶
RequestCtxUser extracts the CtxUser value from the request context.
Types ¶
This section is empty.