justows.plugin.http.jwt
v0.5.0
Published
Plugin for JSON Web Token support.
Downloads
10
Maintainers
Readme
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) : objectopts: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 theAuthorizationheader? Default:false.field(string). Field name where to save the decoded token in thereqobject. Default:token.iss(string).issclaim to check.aud(string).audclaim to check.exp(bool). To checkexpclaim.
Example:
http: {
plugins: [
require("justows.plugin.http.jwt")({alg: "HS259", secret: "1234567890", cookie: "Token"})
]
...
}