@adonisjs/auth
Advanced tools
Comparing version 3.0.7 to 3.1.0
@@ -0,1 +1,10 @@ | ||
# [3.1.0](https://github.com/adonisjs/adonis-auth/compare/v3.0.7...v3.1.0) (2019-11-05) | ||
### Features | ||
* add support for jwt public key ([d9f1ad9](https://github.com/adonisjs/adonis-auth/commit/d9f1ad9)) | ||
<a name="3.0.7"></a> | ||
@@ -2,0 +11,0 @@ ## [3.0.7](https://github.com/adonisjs/adonis-auth/compare/v3.0.6...v3.0.7) (2018-10-01) |
{ | ||
"name": "@adonisjs/auth", | ||
"version": "3.0.7", | ||
"version": "3.1.0", | ||
"description": "Offical authentication provider for Adonis framework", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -70,2 +70,13 @@ 'use strict' | ||
/** | ||
* The jwt public | ||
* | ||
* @attribute jwtPublic | ||
* @type {String|Null} | ||
* @readOnly | ||
*/ | ||
get jwtPublic () { | ||
return _.get(this.jwtOptions, 'public', null) | ||
} | ||
/** | ||
* Signs payload with jwtSecret using {{#crossLink "JwtScheme/jwtOptions:attribute"}}{{/crossLink}} | ||
@@ -83,3 +94,3 @@ * | ||
_signToken (payload, options) { | ||
options = _.size(options) && _.isPlainObject(options) ? options : _.omit(this.jwtOptions, 'secret') | ||
options = _.size(options) && _.isPlainObject(options) ? options : _.omit(this.jwtOptions, ['secret', 'public']) | ||
return signToken(payload, this.jwtSecret, options) | ||
@@ -101,4 +112,5 @@ } | ||
_verifyToken (token) { | ||
const options = _.omit(this.jwtOptions, 'secret') | ||
return verifyToken(token, this.jwtSecret, options) | ||
const options = _.omit(this.jwtOptions, ['secret', 'public']) | ||
const secretOrPublicKey = this.jwtPublic !== null ? this.jwtPublic : this.jwtSecret | ||
return verifyToken(token, secretOrPublicKey, options) | ||
} | ||
@@ -105,0 +117,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
115450
3368