Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Commit 5eb13cd

Browse files
author
Ashish Mishra
committed
Fixing issues 71, 78, 80
This is a fix for issues #71, #78 , and #80
2 parents b7122eb + 22c2715 commit 5eb13cd

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

lib/self-signed-jwt.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,15 @@ SelfSignedJwt.prototype._throwOnInvalidJwtSignature = function(jwt) {
124124
};
125125

126126
SelfSignedJwt.prototype._signJwt = function(header, payload, certificate) {
127-
var jwt = jws.sign({ header : header, payload : payload, secret : certificate});
127+
var jwt;
128+
try {
129+
jwt = jws.sign({ header : header, payload : payload, secret : certificate });
130+
}
131+
catch (err) {
132+
this._log.error(err);
133+
throw this._log.createError('Failed to sign JWT.This is most likely due to an invalid certificate.');
134+
}
135+
128136
this._throwOnInvalidJwtSignature(jwt);
129137
return jwt;
130138
};

lib/token-request.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,11 +354,12 @@ TokenRequest.prototype._getTokenUsernamePasswordFederated = function(username, p
354354
var mex = this._createMex(mexEndpoint);
355355
mex.discover(function(mexErr) {
356356
var wstrustEndpoint;
357-
var wstrustVersion = WSTrustVersion.UNDEFINED;
357+
wstrustVersion = WSTrustVersion.UNDEFINED;
358358
if (mexErr) {
359359
self._log.warn('MEX exchange failed. Attempting fallback to AAD supplied endpoint.');
360360

361361
wstrustEndpoint = self._userRealm.federationActiveAuthUrl;
362+
wstrustVersion = self._parseWStrustVersionFromFederationActiveAuthUrl(self._userRealm.federationActiveAuthUrl);
362363
if (!wstrustEndpoint) {
363364
callback(self._createADWSTrustEndpointError());
364365
return;

sample/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
, "private": true
55
, "dependencies": {
66
"adal-node": ">= 0.1.3",
7-
"express": "2.x",
7+
"express": "3.x",
88
"connect-logger": "0.x",
99
"cookie-parser": "1.x",
1010
"cookie-session": "1.x"

0 commit comments

Comments
 (0)