loopback-component-oauth2
Advanced tools
Comparing version 2.0.0-beta9 to 2.0.0-rc1
@@ -0,4 +1,12 @@ | ||
2015-05-16, Version 2.0.0-rc1 | ||
============================= | ||
* Add revoke middleware (Raymond Feng) | ||
2015-04-10, Version 2.0.0-beta9 | ||
=============================== | ||
* 2.0.0-beta9 (Raymond Feng) | ||
* Upgrade to jws 3.0.0 (Raymond Feng) | ||
@@ -5,0 +13,0 @@ |
@@ -116,2 +116,14 @@ var debug = require('debug')('loopback:oauth2:models'); | ||
token.delete = function(clientId, token, tokenType, done) { | ||
var where = { | ||
clientId: clientId | ||
}; | ||
if (tokenType === 'access_token') { | ||
where.token = token; | ||
} else { | ||
where.refreshToken = token; | ||
} | ||
oAuthTokenModel.destroyAll(where, done); | ||
}; | ||
token.save = function(token, clientId, resourceOwner, scopes, refreshToken, done) { | ||
@@ -118,0 +130,0 @@ var tokenObj; |
@@ -675,2 +675,14 @@ /** | ||
handlers.revoke = [ | ||
passport.authenticate( | ||
['loopback-oauth2-client-password', | ||
'loopback-oauth2-client-basic', | ||
'loopback-oauth2-jwt-bearer'], | ||
{session: false}), | ||
server.revoke(function(client, token, tokenType, cb) { | ||
models.accessTokens.delete(client.id, token, tokenType, cb); | ||
}), | ||
server.errorHandler() | ||
]; | ||
/** | ||
@@ -760,2 +772,3 @@ * BasicStrategy & ClientPasswordStrategy | ||
options.tokenPath || '/oauth/token', | ||
options.revokePath || '/oauth/revoke', | ||
options.decisionPath || '/oauth/authorize/decision', | ||
@@ -779,2 +792,5 @@ options.loginPath || '/login' | ||
} | ||
if (options.revokePath !== false) { | ||
app.post(options.revokePath || '/oauth/revoke', handlers.revoke); | ||
} | ||
@@ -781,0 +797,0 @@ if (options.loginPath !== false) { |
@@ -8,2 +8,3 @@ /** | ||
, transactionLoader = require('./middleware/transactionLoader') | ||
, revoke = require('./middleware/revoke') | ||
, token = require('./middleware/token') | ||
@@ -152,2 +153,12 @@ , errorHandler = require('./middleware/errorHandler') | ||
/** | ||
* Handles token revocation | ||
* @param options | ||
* @param {Function} revokeToken A function to revoke token | ||
* @returns {Function|*} | ||
*/ | ||
Server.prototype.revoke = function(options, revokeToken) { | ||
return revoke(this, options); | ||
} | ||
/** | ||
* Respond to errors encountered in OAuth 2.0 endpoints. | ||
@@ -154,0 +165,0 @@ * |
{ | ||
"name": "loopback-component-oauth2", | ||
"version": "2.0.0-beta9", | ||
"version": "2.0.0-rc1", | ||
"description": "OAuth 2.0 provider for LoopBack", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
465924
47
4272