Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

loopback-component-oauth2

Package Overview
Dependencies
Maintainers
4
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

loopback-component-oauth2 - npm Package Compare versions

Comparing version 2.0.0-beta9 to 2.0.0-rc1

lib/middleware/revoke.js

8

CHANGES.md

@@ -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 @@ *

2

package.json
{
"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": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc