0.5.0 • Published 7 years ago
justows.plugin.http.jwt v0.5.0
justows.plugin.http.jwt
Plugin for JSON Web Token support.
Developed in Dogma, compiled to JavaScript.
Engineered in Valencia, Spain, EU by Justo WebServices.
Description
This plugin provides a pre action for processing a JSON Web Token stored in a cookie or in the Authorization header.
Use
The plugin returns a function which returns the plugin metadata:
function plugin(opts:object) : object
opts
:alg
(string, required). Algorithm to use:HS256
,HS384
,HS512
,RS256
,RS384
,RS512
.secret
(string, required when usingHS*
). Secret to use withHS*
.key
(string, required when usingRS*
). Public key to use.cookie
(string). Cookie name where the JWT is stored.authorization
(bool). Is the token stored in theAuthorization
header? Default:false
.field
(string). Field name where to save the decoded token in thereq
object. Default:token
.iss
(string).iss
claim to check.aud
(string).aud
claim to check.exp
(bool). To checkexp
claim.
Example:
http: {
plugins: [
require("justows.plugin.http.jwt")({alg: "HS259", secret: "1234567890", cookie: "Token"})
]
...
}