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.11 to 0.1.12

6

changelog.txt

@@ -0,1 +1,7 @@

Version 0.1.12
--------------
Release Date: 19 February 2015
* Add login.microsoftonline.com to the static list of known authorities.
* Bug fixes. (#36)
Version 0.1.11

@@ -2,0 +8,0 @@ --------------

4

lib/authentication-parameters.js

@@ -68,2 +68,3 @@ /*

* The resource for a which a token should be requested from the authority.
* This property may be undefined if the resource was not returned in the challenge.
* @instance

@@ -161,5 +162,2 @@ * @memberOf AuthenticationParameters

var resource = challengeParameters[consts.RESOURCE];
if (!resource) {
throw new Error('Could not find \'resource\' in challenge header.');
}

@@ -166,0 +164,0 @@ return new AuthenticationParameters(authorizationUri, resource);

@@ -80,5 +80,2 @@ /*

// This is fallback metadata in case the discovery endpoint is not available.
Authority.AAD_METADATA = '{"version":"1","instances":[{"id":"https://login.windows.net","endpoints":[{"location":"https://login.windows.net/{tenant}/oauth2/authorize","usage":"Auth20Authorize"},{"location":"https://login.windows.net/{tenant}/oauth2/token","usage":"Auth20Token"}]}]}';
/**

@@ -135,3 +132,3 @@ * Checks the authority url to ensure that it meets basic requirements such as being over SSL. If it does not then

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

@@ -138,0 +135,0 @@

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

WORLD_WIDE_AUTHORITY : 'login.windows.net',
WELL_KNOWN_AUTHORITY_HOSTS : ['login.windows.net', 'login.chinacloudapi.cn', 'login.cloudgovapi.us'],
WELL_KNOWN_AUTHORITY_HOSTS : ['login.windows.net', 'login.microsoftonline.com', 'login.chinacloudapi.cn', 'login.cloudgovapi.us'],
INSTANCE_DISCOVERY_ENDPOINT_TEMPLATE : 'https://{authorize_host}/common/discovery/instance?authorization_endpoint={authorize_endpoint}&api-version=1.0',
AUTHORIZE_ENDPOINT_PATH : '/oauth2/authorize',
TOKEN_ENDPOINT_PATH : '/oauth2/token'

@@ -121,0 +122,0 @@ },

@@ -18,3 +18,3 @@ {

},
"version": "0.1.11",
"version": "0.1.12",
"description": "Windows Azure Active Directory Client Library for node",

@@ -21,0 +21,0 @@ "keywords": [ "node", "azure", "AAD", "adal", "adfs", "oauth" ],

@@ -157,3 +157,5 @@ /*

'Bearer authorization_uri="foobar,lkfj,;l,"',
null
{
'authorizationUri' : 'foobar,lkfj,;l,'
}
],

@@ -257,3 +259,3 @@ // Missing authoritzation uri.

util.matchStandardRequestHeaders(getResource);
util.matchStandardRequestHeaders(getResource);

@@ -284,3 +286,3 @@ adal.createAuthenticationParametersFromUrl(testUrl, function(err, parameters) {

util.matchStandardRequestHeaders(getResource);
util.matchStandardRequestHeaders(getResource);

@@ -324,3 +326,3 @@ var urlObj = url.parse(testUrl);

util.matchStandardRequestHeaders(getResource);
util.matchStandardRequestHeaders(getResource);

@@ -327,0 +329,0 @@ adal.createAuthenticationParametersFromUrl(testUrl, function(err) {

@@ -25,2 +25,4 @@ /*

/* global test */
/* global setup */
/* global teardown */

@@ -42,4 +44,15 @@ var assert = require('assert');

setup(function() {
util.resetLogging();
util.clearStaticCache();
});
teardown(function() {
util.resetLogging();
util.clearStaticCache();
});
// use this as authority to force dynamic as opposed to static instance discovery.
var nonHardCodedAuthority = 'https://login.doesntexist.com/' + cp.tenant;
var nonHardCodedAuthorizeEndpoint = nonHardCodedAuthority + '/oauth2/authorize';

@@ -64,3 +77,3 @@

},
nonHardCodedAuthority
nonHardCodedAuthorizeEndpoint
);

@@ -86,2 +99,46 @@

function performStaticInstanceDiscovery(authorityHost, callback) {
var hardCodedAuthority = 'https://' + authorityHost + '/' + cp.tenant;
var responseOptions = {
authority : hardCodedAuthority
};
var response = util.createResponse(responseOptions);
var wireResponse = response.wireResponse;
var tokenRequest = util.setupExpectedClientCredTokenRequestResponse(200, wireResponse, hardCodedAuthority);
var context = new AuthenticationContext(hardCodedAuthority);
context.acquireTokenWithClientCredentials(response.resource, cp.clientId, cp.clientSecret, function (err, tokenResponse) {
if (!err) {
assert(util.isMatchTokenResponse(response.cachedResponse, tokenResponse), 'The response does not match what was expected.: ' + JSON.stringify(tokenResponse));
tokenRequest.done();
}
callback(err);
});
}
test('success-static-instance-discovery', function(done) {
performStaticInstanceDiscovery('login.windows.net', function(err) {
if(err) {
done(err);
return;
}
performStaticInstanceDiscovery('login.microsoftonline.com', function(err2) {
if(err2) {
done(err2);
return;
}
performStaticInstanceDiscovery('login.chinacloudapi.cn', function(err3) {
if(err3) {
done(err3);
return;
}
performStaticInstanceDiscovery('login.cloudgovapi.us', function(err4) {
done(err4);
});
});
});
});
});
test('http-error', function(done) {

@@ -96,3 +153,3 @@ var expectedInstanceDiscoveryRequests = [

var instanceDiscoveryRequests = setupExpectedInstanceDiscoveryRequestRetries(expectedInstanceDiscoveryRequests, nonHardCodedAuthority);
var instanceDiscoveryRequests = setupExpectedInstanceDiscoveryRequestRetries(expectedInstanceDiscoveryRequests, nonHardCodedAuthorizeEndpoint);

@@ -120,3 +177,3 @@ var context = new AuthenticationContext(nonHardCodedAuthority);

var instanceDiscoveryRequests = setupExpectedInstanceDiscoveryRequestRetries(expectedInstanceDiscoveryRequests, nonHardCodedAuthority);
var instanceDiscoveryRequests = setupExpectedInstanceDiscoveryRequestRetries(expectedInstanceDiscoveryRequests, nonHardCodedAuthorizeEndpoint);

@@ -192,3 +249,3 @@ var context = new AuthenticationContext(nonHardCodedAuthority);

},
nonHardCodedAuthority
nonHardCodedAuthorizeEndpoint
);

@@ -195,0 +252,0 @@

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