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

adal-node

Package Overview
Dependencies
Maintainers
2
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

adal-node - npm Package Compare versions

Comparing version 0.1.27 to 0.1.28

5

changelog.md

@@ -0,1 +1,6 @@

Version 0.1.28
--------------
Release Date: 26 Feburary 2018
* Added GDPR support per Microsoft policy.
Version 0.1.27

@@ -2,0 +7,0 @@ --------------

2

lib/adal.d.ts

@@ -28,2 +28,3 @@ import * as http from "http";

* @property {LoggingLevel} [level] The maximum level of log entries to generate.
* @property {boolean} [loggingWithPII] This value indicts if personal identity related information such as token and claims should be logged. The default value is false.
*/

@@ -33,2 +34,3 @@ interface LoggingOptions {

level?: LoggingLevel;
loggingWithPII?: boolean;
}

@@ -35,0 +37,0 @@

7

lib/authentication-parameters.js

@@ -239,7 +239,8 @@ /*

logger.verbose('Attempting to retrieve authentication parameters from: ' + challengeUrl);
logger.verbose('Attempting to retrieve authentication parameters');
logger.verbose('Attempting to retrieve authentication parameters from: ' + challengeUrl, true);
var options = util.createRequestOptions( { _callContext : { _logContext: logContext } } );
request.get(challengeUrl, options, function(err, response) {
if (err) {
logger.error('Authentication parameters http get failed.', err);
logger.error('Authentication parameters http get failed.', err, true);
callback(err);

@@ -252,3 +253,3 @@ return;

} catch(creationErr) {
logger.error('Unable to parse response in to authentication paramaters.', creationErr);
logger.error('Unable to parse response in to authentication paramaters.', creationErr, true);
callback(creationErr);

@@ -255,0 +256,0 @@ return;

@@ -138,3 +138,3 @@ /*

Authority.prototype._createAuthorityUrl = function() {
return 'https://' + this._url.host + '/' + this._tenant + AADConstants.AUTHORIZE_ENDPOINT_PATH;
return 'https://' + this._url.host + '/' + encodeURIComponent(this._tenant) + AADConstants.AUTHORIZE_ENDPOINT_PATH;
};

@@ -170,3 +170,4 @@

this._log.verbose('Attempting instance discover at: ' + url.format(discoveryEndpoint));
this._log.verbose('Attempting instance discover');
this._log.verbose('Attempting instance discover at: ' + url.format(discoveryEndpoint), true);
request.get(discoveryEndpoint, getOptions, util.createRequestHandler('Instance Discovery', this._log, callback,

@@ -232,7 +233,7 @@ function(response, body) {

if (!this._tokenEndpoint){
this._tokenEndpoint = url.format('https://' + this._url.host + '/' + this._tenant) + AADConstants.TOKEN_ENDPOINT_PATH;
this._tokenEndpoint = url.format('https://' + this._url.host + '/' + encodeURIComponent(this._tenant)) + AADConstants.TOKEN_ENDPOINT_PATH;
}
if (!this._deviceCodeEndpoint){
this._deviceCodeEndpoint = url.format('https://' + this._url.host + '/' + this._tenant) + AADConstants.DEVICE_ENDPOINT_PATH;
this._deviceCodeEndpoint = url.format('https://' + this._url.host + '/' + encodeURIComponent(this._tenant)) + AADConstants.DEVICE_ENDPOINT_PATH;
}

@@ -261,3 +262,4 @@

if (!this._validated) {
this._log.verbose('Performing instance discovery: ' + url.format(this._url));
this._log.verbose('Performing instance discovery');
this._log.verbose('Performing instance discovery: ' + url.format(this._url), true);
this._validateViaInstanceDiscovery(function(err, tenantDiscoveryEndpoint) {

@@ -274,3 +276,4 @@ if (err)

} else {
this._log.verbose('Instance discovery/validation has either already been completed or is turned off: ' + url.format(this._url));
this._log.verbose('Instance discovery/validation has either already been completed or is turned off');
this._log.verbose('Instance discovery/validation has either already been completed or is turned off: ' + url.format(this._url), true);
this._getOAuthEndpoints(null, callback);

@@ -277,0 +280,0 @@ return;

@@ -160,3 +160,3 @@ /*

this._log.verbose('Looking for potential cache entries:');
this._log.verbose(JSON.stringify(potentialEntriesQuery));
this._log.verbose(JSON.stringify(potentialEntriesQuery), true);
this._find(potentialEntriesQuery, function(err, entries) {

@@ -229,3 +229,4 @@ self._log.verbose('Found ' + entries.length + ' potential entries.');

if (returnVal) {
self._log.verbose('Returning token from cache lookup, ' + createTokenIdMessage(returnVal));
self._log.verbose('Returning token from cache lookup');
self._log.verbose('Returning token from cache lookup, ' + createTokenIdMessage(returnVal), true);
}

@@ -284,3 +285,3 @@ callback(null, returnVal, isResourceTenantSpecific);

if (err) {
self._log.error('error refreshing expired token', err);
self._log.error('error refreshing expired token', err, true);
} else {

@@ -310,3 +311,3 @@ self._log.info('Returning token refreshed after expiry.');

if (err) {
self._log.error('error refreshing mrrt', err);
self._log.error('error refreshing mrrt', err, true);
} else {

@@ -355,3 +356,4 @@ self._log.info('Returning token derived from mrrt refresh.');

query = query || {};
this._log.verbose('finding with query:' + JSON.stringify(query));
this._log.verbose('finding using query');
this._log.verbose('finding with query:' + JSON.stringify(query), true);
this._loadSingleEntryFromCache(query, function(err, entry, isResourceTenantSpecific) {

@@ -507,2 +509,3 @@ if (err) {

var self = this;
this._log.verbose('Adding entry');
this._log.verbose('Adding entry, ' + createTokenIdMessage(entry));

@@ -509,0 +512,0 @@

@@ -95,2 +95,6 @@ /*

if (options.loggingWithPII != true) {
options.loggingWithPII = false;
}
this.LogOptions = options;

@@ -115,2 +119,3 @@ },

level : 0,
loggingWithPII: false
}

@@ -146,4 +151,9 @@ };

* should pass an error object in this parameter.
* @param {boolean} [containsPII] Determines if the log message contains personal information. Default value is false.
*/
Logger.prototype.log = function(level, message, error) {
Logger.prototype.log = function (level, message, error, containsPII) {
if (containsPII == true && !Logging.LogOptions.loggingWithPII) {
return;
}
if (level <= Logging.LogOptions.level) {

@@ -169,5 +179,6 @@ if (_.isFunction(message)) {

* @param {Error} error The Error object associated with this log entry
* @param {boolean} [containsPII] Determines if the log message contains personal information. Default value is false.
*/
Logger.prototype.error = function(message, error) {
this.log(Logging.LOGGING_LEVEL.ERROR, message, error);
Logger.prototype.error = function (message, error, containsPII) {
this.log(Logging.LOGGING_LEVEL.ERROR, message, error, containsPII);
};

@@ -178,5 +189,6 @@

* @param {string} message A message to log
* @param {boolean} [containsPII] Determines if the log message contains personal information. Default value is false.
*/
Logger.prototype.warn = function(message) {
this.log(Logging.LOGGING_LEVEL.WARN, message, null);
Logger.prototype.warn = function (message, containsPII) {
this.log(Logging.LOGGING_LEVEL.WARN, message, null, containsPII);
};

@@ -187,5 +199,6 @@

* @param {string} message A message to log
* @param {boolean} [containsPII] Determines if the log message contains personal information. Default value is false.
*/
Logger.prototype.info = function(message) {
this.log(Logging.LOGGING_LEVEL.INFO, message, null);
Logger.prototype.info = function (message, containsPII) {
this.log(Logging.LOGGING_LEVEL.INFO, message, null, containsPII);
};

@@ -196,5 +209,6 @@

* @param {string} message A message to log
* @param {boolean} [containsPII] Determines if the log message contains personal information. Default value is false.
*/
Logger.prototype.verbose = function(message) {
this.log(Logging.LOGGING_LEVEL.VERBOSE, message, null);
Logger.prototype.verbose = function (message, containsPII) {
this.log(Logging.LOGGING_LEVEL.VERBOSE, message, null, containsPII);
};

@@ -206,6 +220,7 @@

* @param {string} message A message to log
* @param {boolean} [containsPII] Determines if the log message contains personal information. Default value is false.
*/
Logger.prototype.createError = function(message) {
Logger.prototype.createError = function(message, containsPII) {
var err = new Error(message);
this.error(message, err);
this.error(message, err, containsPII);
return err;

@@ -212,0 +227,0 @@ };

@@ -50,3 +50,4 @@ /*

this._usernamePasswordPolicy = {};
this._log.verbose('Mex created with url: ' + url);
this._log.verbose('Mex created');
this._log.verbose('Mex created with url: ' + url, true);
}

@@ -79,2 +80,3 @@

Mex.prototype.discover = function (callback) {
this._log.verbose('Retrieving mex');
this._log.verbose('Retrieving mex at: ' + this._url);

@@ -94,3 +96,3 @@ var self = this;

} catch (err) {
self._log.error('Failed to parse mex response in to DOM', err);
self._log.error('Failed to parse mex response in to DOM', err, true);
callback(err);

@@ -125,3 +127,4 @@ }

if (policyId) {
this._log.verbose('found matching policy id: ' + policyId);
this._log.verbose('found matching policy id');
this._log.verbose('found matching policy id: ' + policyId, true);
} else {

@@ -131,3 +134,4 @@ if (!id) {

}
this._log.verbose('potential policy did not match required transport binding: ' + id);
this._log.verbose('potential policy did not match required transport binding');
this._log.verbose('potential policy did not match required transport binding: ' + id, true);
}

@@ -134,0 +138,0 @@ return policyId;

@@ -231,4 +231,5 @@ /*

idToken = JSON.parse(base64Decoded);
} catch(err) {
this._log.warn('The returned id_token could not be decoded: ' + err.stack);
} catch (err) {
this._log.warn('the returned id_token could not be decoded');
this._log.warn('The returned id_token could not be decoded: ' + err.stack, true);
return;

@@ -383,3 +384,3 @@ }

} catch (e) {
this._log.error('Error validating get token response', e);
this._log.error('Error validating get token response', e, true);
callback(e);

@@ -396,3 +397,3 @@ return;

} catch (e) {
this._log.error('Error validating get user code response', e);
this._log.error('Error validating get user code response', e, true);
callback(e);

@@ -427,3 +428,3 @@ return;

} catch (e) {
self._log.error('Error validating get token response', e);
self._log.error('Error validating get token response', e, true);
callback(null, e);

@@ -430,0 +431,0 @@ return;

@@ -90,3 +90,4 @@ /*

this._log.verbose('Creating self signed JWT header. x5t: ' + x5t);
this._log.verbose('Creating self signed JWT header');
this._log.verbose('Creating self signed JWT header. x5t: ' + x5t, true);

@@ -133,3 +134,3 @@ return header;

catch (err) {
this._log.error(err);
this._log.error(err, true);
throw this._log.createError('Failed to sign JWT.This is most likely due to an invalid certificate.');

@@ -136,0 +137,0 @@ }

@@ -142,3 +142,4 @@ /*

if (err) {
self._log.warn('Attempt to look for token in cache resulted in Error: ' + err.stack);
self._log.warn('Attempt to look for token in cahce resulted in Error');
self._log.warn('Attempt to look for token in cache resulted in Error: ' + err.stack, true);
}

@@ -294,3 +295,3 @@

if (!response.token) {
var rstrErr = self._log.createError('Unsucessful RSTR.\n\terror code: ' + response.errorCode + '\n\tfaultMessage: ' + response.faultMessage);
var rstrErr = self._log.createError('Unsucessful RSTR.\n\terror code: ' + response.errorCode + '\n\tfaultMessage: ' + response.faultMessage, true);
callback(rstrErr);

@@ -355,3 +356,4 @@ return;

var mexEndpoint = this._userRealm.federationMetadataUrl;
this._log.verbose('Attempting mex at: ' + mexEndpoint);
this._log.verbose('Attempting mex');
this._log.verbose('Attempting mex at: ' + mexEndpoint, true);
var mex = this._createMex(mexEndpoint);

@@ -358,0 +360,0 @@ mex.discover(function(mexErr) {

@@ -191,4 +191,4 @@ /*

this._log.verbose(' FederationProtocol: ' + this.federationProtocol);
this._log.verbose(' FederationMetatdataUrl: ' + this.federationMetadataUrl);
this._log.verbose(' FederationActiveAuthUrl: ' + this.federationActiveAuthUrl);
this._log.verbose(' FederationMetatdataUrl: ' + this.federationMetadataUrl, true);
this._log.verbose(' FederationActiveAuthUrl: ' + this.federationActiveAuthUrl, true);
};

@@ -203,3 +203,3 @@

UserRealm.prototype._parseDiscoveryResponse = function(body, callback) {
this._log.verbose('Discovery response:\n' + body);
this._log.verbose('Discovery response:\n' + body, true);

@@ -210,3 +210,3 @@ var response;

} catch (err) {
callback(this._log.createError('Parsing realm discovery respone JSON failed: ' + body));
callback(this._log.createError('Parsing realm discovery respone JSON failed: ' + body, true));
return;

@@ -263,3 +263,3 @@ }

var userRealmUrl = this._getUserRealmUrl();
this._log.verbose('Performing user realm discovery at: ' + url.format(userRealmUrl));
this._log.verbose('Performing user realm discovery at: ' + url.format(userRealmUrl), true);
request.get(userRealmUrl, options, util.createRequestHandler('User Realm Discovery', this._log, callback,

@@ -266,0 +266,0 @@ function(response, body) {

@@ -96,3 +96,3 @@ /*

if (response && response.headers && response.headers['client-request-id']) {
log.info(operationMessage + 'Server returned this correlationId: ' + response.headers['client-request-id']);
log.info(operationMessage + 'Server returned this correlationId: ' + response.headers['client-request-id'], true);
}

@@ -116,3 +116,3 @@ }

if (err) {
log.error(operationMessage + ' request failed with', err);
log.error(operationMessage + ' request failed with', err, true);
errorCallback(err);

@@ -132,3 +132,3 @@ return;

}
errorCallback(log.createError(returnErrorString), errorResponse);
errorCallback(log.createError(returnErrorString, true), errorResponse);
return;

@@ -135,0 +135,0 @@ }

@@ -170,3 +170,3 @@ /*

this._log.verbose('Created RST: \n' + RSTTemplate);
this._log.verbose('Created RST: \n' + RSTTemplate, true);

@@ -225,3 +225,3 @@ var RST = this._populateRSTUsernamePassword(RSTTemplate, username, password);

this._log.verbose('Sending RST to: ' + this._wstrustEndpointUrl);
this._log.verbose('Sending RST to: ' + this._wstrustEndpointUrl, true);

@@ -228,0 +228,0 @@ request.post(this._wstrustEndpointUrl, options, util.createRequestHandler('WS-Trust RST', this._log, callback,

@@ -270,3 +270,3 @@ /*

} catch (err) {
throw this._log.createError('Failed to parse RSTR in to DOM', err);
throw this._log.createError('Failed to parse RSTR in to DOM', err, true);
}

@@ -279,3 +279,3 @@

var stringFaultMessage = this.FaultMessage || 'NONE';
throw this._log.createError('Server returned error in RSTR - ErrorCode: ' + stringErrorCode + ' : FaultMessage: ' + stringFaultMessage);
throw this._log.createError('Server returned error in RSTR - ErrorCode: ' + stringErrorCode + ' : FaultMessage: ' + stringFaultMessage, true);
}

@@ -282,0 +282,0 @@

{
"name": "adal-node",
"version": "0.1.27",
"version": "0.1.28",
"lockfileVersion": 1,

@@ -5,0 +5,0 @@ "requires": true,

@@ -13,3 +13,3 @@ {

},
"version": "0.1.27",
"version": "0.1.28",
"description": "Windows Azure Active Directory Client Library for node",

@@ -16,0 +16,0 @@ "keywords": [

@@ -5,3 +5,3 @@ # Windows Azure Active Directory Authentication Library (ADAL) for Node.js

## Versions
Current version - 0.1.27
Current version - 0.1.28
Minimum recommended version - 0.1.22

@@ -33,2 +33,16 @@ You can find the changes for each version in the [change log](https://github.com/AzureAD/azure-activedirectory-library-for-nodejs/blob/master/changelog.txt).

### Configure the logging
```javascript
var logging = require('adal-node').Logging;
logging.setLoggingOptions({
log: function(level, message, error) {
// provide your own implementation of the log function
},
level: logging.LOGGING_LEVEL.VERBOSE, // provide the logging level
loggingWithPII: false // Determine if you want to log personal identitification information. The default value is false.
});
```
### Authorization Code

@@ -108,3 +122,3 @@

```javascript
var adal = require('adal-node').AuthenticationContext;
var AuthenticationContext = require('adal-node').AuthenticationContext;

@@ -111,0 +125,0 @@ var authorityHostUrl = 'https://login.windows.net';

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