Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var qs = require("qs");
var querystring = require('querystring');
var cons = require('consolidate');
var randomstring = require("randomstring");
var jose = require('jsrsasign');
var base64url = require('base64url');
var __ = require('underscore');
__.string = require('underscore.string');
var app = express();
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.engine('html', cons.underscore);
app.set('view engine', 'html');
app.set('views', 'files/client');
// client information
var client = {
"client_id": "oauth-client-1",
"client_secret": "oauth-client-secret-1",
"redirect_uris": ["http://localhost:9000/callback"],
"scope": "openid profile email phone address"
};
// authorization server information
var authServer = {
authorizationEndpoint: 'http://localhost:9001/authorize',
tokenEndpoint: 'http://localhost:9001/token',
var randomstring = require("randomstring");
var cons = require('consolidate');
var nosql = require('nosql').load('database.nosql');
var querystring = require('querystring');
var qs = require("qs");
var __ = require('underscore');
__.string = require('underscore.string');
var base64url = require('base64url');
var jose = require('jsrsasign');
var app = express();
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true })); // support form-encoded bodies (for the token endpoint)
app.engine('html', cons.underscore);
app.set('view engine', 'html');
app.set('views', 'files/authorizationServer');
app.set('json spaces', 4);
// authorization server information
var authServer = {
authorizationEndpoint: 'http://localhost:9001/authorize',
tokenEndpoint: 'http://localhost:9001/token'
};
// client information
var clients = [
{
"client_id": "oauth-client-1",
"client_secret": "oauth-client-secret-1",
"redirect_uris": ["http://localhost:9000/callback"],
var bodyParser = require('body-parser');
var randomstring = require("randomstring");
var cons = require('consolidate');
var nosql = require('nosql').load('database.nosql');
var querystring = require('querystring');
var __ = require('underscore');
__.string = require('underscore.string');
var base64url = require('base64url');
var crypto = require('crypto');
var app = express();
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true })); // support form-encoded bodies (for the token endpoint)
app.engine('html', cons.underscore);
app.set('view engine', 'html');
app.set('views', 'files/authorizationServer');
app.set('json spaces', 4);
// authorization server information
var authServer = {
authorizationEndpoint: 'http://localhost:9001/authorize',
tokenEndpoint: 'http://localhost:9001/token'
};
// client information
var clients = [
{
"client_id": "oauth-client-1",
"client_secret": "oauth-client-secret-1",
var url = require("url");
var bodyParser = require('body-parser');
var randomstring = require("randomstring");
var cons = require('consolidate');
var nosql = require('nosql').load('database.nosql');
var querystring = require('querystring');
var qs = require('qs');
var __ = require('underscore');
__.string = require('underscore.string');
var app = express();
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true })); // support form-encoded bodies (for the token endpoint)
app.engine('html', cons.underscore);
app.set('view engine', 'html');
app.set('views', 'files/authorizationServer');
app.set('json spaces', 4);
// authorization server information
var authServer = {
authorizationEndpoint: 'http://localhost:9001/authorize',
tokenEndpoint: 'http://localhost:9001/token'
};
// client information
var clients = [
{
"client_id": "oauth-client-1",
"client_secret": "oauth-client-secret-1",
var express = require("express");
var request = require("sync-request");
var url = require("url");
var qs = require("qs");
var querystring = require('querystring');
var cons = require('consolidate');
var randomstring = require("randomstring");
var __ = require('underscore');
__.string = require('underscore.string');
var base64url = require('base64url');
var crypto = require('crypto');
var app = express();
app.engine('html', cons.underscore);
app.set('view engine', 'html');
app.set('views', 'files/client');
// authorization server information
var authServer = {
authorizationEndpoint: 'http://localhost:9001/authorize',
tokenEndpoint: 'http://localhost:9001/token'
};
// client information
var client = {
"client_id": "oauth-client-1",
"client_secret": "oauth-client-secret-1",
"redirect_uris": ["http://localhost:9000/callback"]
};
var qs = require("qs");
var querystring = require('querystring');
var cons = require('consolidate');
var randomstring = require("randomstring");
var jose = require('jsrsasign');
var base64url = require('base64url');
var __ = require('underscore');
__.string = require('underscore.string');
var app = express();
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.engine('html', cons.underscore);
app.set('view engine', 'html');
app.set('views', 'files/client');
// client information
var client = {
"client_id": "oauth-client-1",
"client_secret": "oauth-client-secret-1",
"redirect_uris": ["http://localhost:9000/callback"],
"scope": "foo bar"
};
// authorization server information
var authServer = {
authorizationEndpoint: 'http://localhost:9001/authorize',
tokenEndpoint: 'http://localhost:9001/token',
var trailer = ';exports=exports||module.exports;global.emitter=exports;})(this)'
res.writeHead(200, {
'Content-Type': 'text/javascript',
'Content-Length': header.length + stat.size + trailer.length
})
var rs = fs.createReadStream(path)
res.write(header)
rs.pipe(res, false)
rs.on('end', function () {
res.end(trailer)
})
})
app.engine('html', require('consolidate').underscore)
app.engine('json', require('consolidate').underscore)
app.engine('ejs', require('consolidate').underscore)
var swaggerIndex = function (req, res) {
fs.readFile(path.resolve('node_modules', 'swagger-ui', 'dist', 'index.html'), function (err, f) { // eslint-disable-line handle-callback-err
f = f.toString().replace('"your-client-id"', '"1"')
res.end(f)
})
}
app.get('/swagger-ui/index.html', swaggerIndex) // TODO: make configurable?
app.get('/swagger-ui', swaggerIndex) // TODO: make configurable?
app.use('/swagger-ui', serveStatic(path.resolve('node_modules', 'swagger-ui', 'dist'))) // TODO: make configurable?
var sprocessed = {}
app.get('/swagger-api/:id', function (req, res, next) { // TODO: make configurable?
if (!sprocessed[req.params.id]) {
sprocessed[req.params.id]
var serverPath = path.resolve('public/swagger_api/' + req.params.id)
fs.readdirSync(serverPath).forEach(function (file) {
var randomstring = require("randomstring");
var cons = require('consolidate');
var nosql = require('nosql').load('database.nosql');
var querystring = require('querystring');
var qs = require("qs");
var __ = require('underscore');
__.string = require('underscore.string');
var base64url = require('base64url');
var jose = require('jsrsasign');
var app = express();
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true })); // support form-encoded bodies (for the token endpoint)
app.engine('html', cons.underscore);
app.set('view engine', 'html');
app.set('views', 'files/authorizationServer');
app.set('json spaces', 4);
// authorization server information
var authServer = {
authorizationEndpoint: 'http://localhost:9001/authorize',
tokenEndpoint: 'http://localhost:9001/token'
};
// client information
var clients = [
{
"client_id": "oauth-client-1",
"client_secret": "oauth-client-secret-1",
"redirect_uris": ["http://localhost:9000/callback"],
var randomstring = require("randomstring");
var cons = require('consolidate');
var nosql = require('nosql').load('database.nosql');
var qs = require("qs");
var querystring = require('querystring');
var request = require("sync-request");
var __ = require('underscore');
var base64url = require('base64url');
var jose = require('jsrsasign');
var cors = require('cors');
var app = express();
app.use(bodyParser.urlencoded({ extended: true })); // support form-encoded bodies (for bearer tokens)
app.engine('html', cons.underscore);
app.set('view engine', 'html');
app.set('views', 'files/protectedResource');
app.set('json spaces', 4);
app.use('/', express.static('files/protectedResource'));
app.use(cors());
var resource = {
"name": "Protected Resource",
"description": "This data has been protected by OAuth 2.0"
};
var sharedTokenSecret = "shared token secret!";
var rsaKey = {
"alg": "RS256",
var express = require("express");
var bodyParser = require('body-parser');
var cons = require('consolidate');
var base64url = require('base64url');
var cors = require('cors');
var app = express();
app.use(bodyParser.urlencoded({ extended: true })); // support form-encoded bodies (for bearer tokens)
app.engine('html', cons.underscore);
app.set('view engine', 'html');
app.set('views', 'files/protectedResource');
app.set('json spaces', 4);
app.use('/', express.static('files/protectedResource'));
app.use(cors());
var resource = {
"name": "Protected Resource",
"description": "This data has been protected by OAuth 2.0"
};
var protectedResources = {
"resource_id": "protected-resource-1",
"resource_secret": "protected-resource-secret-1"
};