Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/node-red/node_modules/passport-oauth2-client-password/lib/ drwxr-xr-x | |
| Viewing file: Select action/file-type: /**
* Module dependencies.
*/
var passport = require('passport-strategy')
, util = require('util');
/**
* `ClientPasswordStrategy` constructor.
*
* @api protected
*/
function Strategy(options, verify) {
if (typeof options == 'function') {
verify = options;
options = {};
}
if (!verify) throw new Error('OAuth 2.0 client password strategy requires a verify function');
passport.Strategy.call(this);
this.name = 'oauth2-client-password';
this._verify = verify;
this._passReqToCallback = options.passReqToCallback;
}
/**
* Inherit from `passport.Strategy`.
*/
util.inherits(Strategy, passport.Strategy);
/**
* Authenticate request based on client credentials in the request body.
*
* @param {Object} req
* @api protected
*/
Strategy.prototype.authenticate = function(req) {
if (!req.body || (!req.body['client_id'] || !req.body['client_secret'])) {
return this.fail();
}
var clientId = req.body['client_id'];
var clientSecret = req.body['client_secret'];
var self = this;
function verified(err, client, info) {
if (err) { return self.error(err); }
if (!client) { return self.fail(); }
self.success(client, info);
}
if (self._passReqToCallback) {
this._verify(req, clientId, clientSecret, verified);
} else {
this._verify(clientId, clientSecret, verified);
}
}
/**
* Expose `Strategy`.
*/
module.exports = Strategy;
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0509 ]-- |