Skip to content

Commit 78ef1b4

Browse files
authored
Merge pull request oauthinaction#44 from oauthinaction/deprecation-updates
Deprecation updates
2 parents 46156b7 + 8c3b532 commit 78ef1b4

File tree

181 files changed

+1387
-1473
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

181 files changed

+1387
-1473
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ example/native-client/plugins/
44
exercises/ch-7-ex-0/platforms/
55
exercises/ch-7-ex-0/plugins/
66
.DS_Store
7+
package-lock.json

class/authorizationServer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ var getScopesFromForm = function(body) {
101101
};
102102

103103
var decodeClientCredentials = function(auth) {
104-
var clientCredentials = new Buffer(auth.slice('basic '.length), 'base64').toString().split(':');
104+
var clientCredentials = Buffer.from(auth.slice('basic '.length), 'base64').toString().split(':');
105105
var clientId = querystring.unescape(clientCredentials[0]);
106106
var clientSecret = querystring.unescape(clientCredentials[1]);
107107
return { id: clientId, secret: clientSecret };

class/client.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ var buildUrl = function(base, options, hash) {
8989
};
9090

9191
var encodeClientCredentials = function(clientId, clientSecret) {
92-
return new Buffer(querystring.escape(clientId) + ':' + querystring.escape(clientSecret)).toString('base64');
92+
return Buffer.from(querystring.escape(clientId) + ':' + querystring.escape(clientSecret)).toString('base64');
9393
};
9494

9595
var server = app.listen(9000, 'localhost', function () {

class/complete/authorizationServer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ app.post("/token", function(req, res){
254254
//var encodedPayload = base64url.encode(JSON.stringify(payload));
255255
256256
//var access_token = encodedHeader + '.' + encodedPayload + '.';
257-
//var access_token = jose.jws.JWS.sign('HS256', stringHeader, stringPayload, new Buffer(sharedTokenSecret).toString('hex'));
257+
//var access_token = jose.jws.JWS.sign('HS256', stringHeader, stringPayload, Buffer.from(sharedTokenSecret).toString('hex'));
258258
259259
var privateKey = jose.KEYUTIL.getKey(rsaKey);
260260
var access_token = jose.jws.JWS.sign(rsaKey.alg, stringHeader, stringPayload, privateKey);
@@ -340,7 +340,7 @@ var getScopesFromForm = function(body) {
340340
};
341341

342342
var decodeClientCredentials = function(auth) {
343-
var clientCredentials = new Buffer(auth.slice('basic '.length), 'base64').toString().split(':');
343+
var clientCredentials = Buffer.from(auth.slice('basic '.length), 'base64').toString().split(':');
344344
var clientId = querystring.unescape(clientCredentials[0]);
345345
var clientSecret = querystring.unescape(clientCredentials[1]);
346346
return { id: clientId, secret: clientSecret };

class/complete/client.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ var buildUrl = function(base, options, hash) {
256256
};
257257

258258
var encodeClientCredentials = function(clientId, clientSecret) {
259-
return new Buffer(querystring.escape(clientId) + ':' + querystring.escape(clientSecret)).toString('base64');
259+
return Buffer.from(querystring.escape(clientId) + ':' + querystring.escape(clientSecret)).toString('base64');
260260
};
261261

262262
var server = app.listen(9000, 'localhost', function () {

class/complete/protectedResource.js

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,18 @@ var getAccessToken = function(req, res, next) {
5151
}
5252

5353
console.log('Incoming token: %s', inToken);
54-
nosql.one(function(token) {
55-
if (token.access_token == inToken) {
56-
return token;
57-
}
58-
}, function(err, token) {
59-
if (token) {
60-
console.log("We found a matching token: %s", inToken);
61-
} else {
62-
console.log('No matching token was found.');
63-
}
64-
req.access_token = token;
65-
next();
66-
return;
54+
nosql.one().make(function(builder) {
55+
builder.where('access_token', inToken);
56+
builder.callback(function(err, token) {
57+
if (token) {
58+
console.log("We found a matching token: %s", inToken);
59+
} else {
60+
console.log('No matching token was found.');
61+
};
62+
req.access_token = token;
63+
next();
64+
return;
65+
})
6766
});
6867

6968
};

class/day2-start/authorizationServer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ var getScopesFromForm = function(body) {
267267
};
268268

269269
var decodeClientCredentials = function(auth) {
270-
var clientCredentials = new Buffer(auth.slice('basic '.length), 'base64').toString().split(':');
270+
var clientCredentials = Buffer.from(auth.slice('basic '.length), 'base64').toString().split(':');
271271
var clientId = querystring.unescape(clientCredentials[0]);
272272
var clientSecret = querystring.unescape(clientCredentials[1]);
273273
return { id: clientId, secret: clientSecret };

class/day2-start/client.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ var buildUrl = function(base, options, hash) {
193193
};
194194

195195
var encodeClientCredentials = function(clientId, clientSecret) {
196-
return new Buffer(querystring.escape(clientId) + ':' + querystring.escape(clientSecret)).toString('base64');
196+
return Buffer.from(querystring.escape(clientId) + ':' + querystring.escape(clientSecret)).toString('base64');
197197
};
198198

199199
var server = app.listen(9000, 'localhost', function () {

class/day2-start/protectedResource.js

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,18 @@ var getAccessToken = function(req, res, next) {
5151
}
5252

5353
console.log('Incoming token: %s', inToken);
54-
nosql.one(function(token) {
55-
if (token.access_token == inToken) {
56-
return token;
57-
}
58-
}, function(err, token) {
59-
if (token) {
60-
console.log("We found a matching token: %s", inToken);
61-
} else {
62-
console.log('No matching token was found.');
63-
}
64-
req.access_token = token;
65-
next();
66-
return;
54+
nosql.one().make(function(builder) {
55+
builder.where('access_token', inToken);
56+
builder.callback(function(err, token) {
57+
if (token) {
58+
console.log("We found a matching token: %s", inToken);
59+
} else {
60+
console.log('No matching token was found.');
61+
};
62+
req.access_token = token;
63+
next();
64+
return;
65+
})
6766
});
6867

6968
};

class/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
"underscore": "^1.8.3",
88
"underscore.string": "^3.1.1",
99
"consolidate": "^0.13.1",
10-
"qs": "^4.0.0",
10+
"qs": "^6.9.3",
1111
"randomstring": "^1.0.7",
12-
"nosql": "^3.0.3",
13-
"base64url": "^1.0.4",
12+
"nosql": "^6.1.0",
13+
"base64url": "^3.0.1",
1414
"cors": "^2.7.1",
15-
"jsrsasign": "^5.0.0"
15+
"jsrsasign": "^8.0.20"
1616
}
1717
}

0 commit comments

Comments
 (0)