Comparing version 0.1.19 to 0.1.20
@@ -0,1 +1,6 @@ | ||
Version 0.1.20 | ||
-------------- | ||
Release Date: 17 Jun 2016 | ||
* Add support for resource owner grant flow for ADFS | ||
Version 0.1.19 | ||
@@ -2,0 +7,0 @@ -------------- |
@@ -45,3 +45,2 @@ /* | ||
this._validated = !validateAuthority; | ||
this._host = null; | ||
@@ -54,2 +53,3 @@ this._tenant = null; | ||
this._deviceCodeEndpoint = null; | ||
this._isAdfsAuthority = (this._tenant.toLowerCase() === "adfs"); | ||
} | ||
@@ -238,3 +238,3 @@ | ||
} | ||
callback(); | ||
@@ -241,0 +241,0 @@ return; |
@@ -167,4 +167,4 @@ /* | ||
/** | ||
* Store token into cache. | ||
* @param {object} tokenResponse Token response to be added into the cache. | ||
* Store token into cache. | ||
* @param {object} tokenResponse Token response to be added into the cache. | ||
*/ | ||
@@ -279,3 +279,3 @@ TokenRequest.prototype._addTokenIntoCache = function(tokenResponse, callback) { | ||
* @param {string} wstrustEndpoint An url of an ADFS WSTrust endpoint. | ||
* @param {string} wstrustEndpointVersion The version of the wstrust endpoint. | ||
* @param {string} wstrustEndpointVersion The version of the wstrust endpoint. | ||
* @param {string} username username | ||
@@ -384,3 +384,3 @@ * @param {string} password password | ||
* @param {string} federationActiveAuthUrl federationActiveAuthUrl | ||
* @return {object} The wstrust endpoint version. | ||
* @return {object} The wstrust endpoint version. | ||
*/ | ||
@@ -390,3 +390,3 @@ TokenRequest.prototype._parseWStrustVersionFromFederationActiveAuthUrl = function(federationActiveAuthUrl) { | ||
var wstrust13Regex = /[/trust]?[13][/usernamemixed]?/; | ||
if (wstrust2005Regex.exec(federationActiveAuthUrl)) { | ||
@@ -398,3 +398,3 @@ return WSTrustVersion.WSTRUST2005; | ||
} | ||
return WSTrustVersion.UNDEFINED; | ||
@@ -413,6 +413,14 @@ }; | ||
this._log.info('Acquiring token with username password'); | ||
this._userId = username; | ||
this._userId = username; | ||
this._getTokenWithCacheWrapper(callback, function(getTokenCompleteCallback) { | ||
var self = this; | ||
if(this._authenticationContext._authority._isAdfsAuthority) { | ||
this._log.info('Skipping user realm discovery for ADFS authority'); | ||
self._getTokenUsernamePasswordManaged(username, password, getTokenCompleteCallback); | ||
return; | ||
} | ||
this._userRealm = this._createUserRealmRequest(username); | ||
@@ -419,0 +427,0 @@ this._userRealm.discover(function(err) { |
@@ -18,3 +18,3 @@ { | ||
}, | ||
"version": "0.1.19", | ||
"version": "0.1.20", | ||
"description": "Windows Azure Active Directory Client Library for node", | ||
@@ -21,0 +21,0 @@ "keywords": [ "node", "azure", "AAD", "adal", "adfs", "oauth" ], |
@@ -14,2 +14,6 @@ # Windows Azure Active Directory Authentication Library (ADAL) for Node.js | ||
## Security Reporting | ||
If you find a security issue with our libraries or services please report it to [secure@microsoft.com](mailto:secure@microsoft.com) with as much detail as possible. Your submission may be eligible for a bounty through the [Microsoft Bounty](http://aka.ms/bugbounty) program. Please do not post security issues to GitHub Issues or any other public site. We will contact you shortly upon receiving the information. We encourage you to get notifications of when security incidents occur by visiting [this page](https://technet.microsoft.com/en-us/security/dd252948) and subscribing to Security Advisory Alerts. | ||
## Contributing | ||
@@ -16,0 +20,0 @@ |
@@ -82,5 +82,4 @@ /* | ||
function setupExpectedUserNamePasswordRequestResponse(httpCode, returnDoc, authorityEndpoint) { | ||
function setupExpectedUserNamePasswordRequestResponse(httpCode, returnDoc, authorityEndpoint, isAdfs) { | ||
var authEndpoint = util.getNockAuthorityHost(authorityEndpoint); | ||
var queryParameters = {}; | ||
@@ -95,2 +94,6 @@ queryParameters['grant_type'] = 'password'; | ||
var query = querystring.stringify(queryParameters); | ||
var tokenUrl = cp.tokenUrlPath; | ||
if(isAdfs) { | ||
tokenUrl = '/adfs' + cp.tokenPath + cp.extraQP; | ||
} | ||
@@ -101,3 +104,3 @@ var tokenRequest = nock(authEndpoint) | ||
}) | ||
.post(cp.tokenUrlPath, query) | ||
.post(tokenUrl, query) | ||
.reply(httpCode, returnDoc); | ||
@@ -110,2 +113,18 @@ | ||
test('happy-path-adfs-authority', function(done) { | ||
var adfsAuthority = "https://contoso.com/adfs"; | ||
var responseOptions = { authority : adfsAuthority, mrrt : true }; | ||
var response = util.createResponse(responseOptions); | ||
var upRequest = setupExpectedUserNamePasswordRequestResponse(200, response.wireResponse, adfsAuthority, true); | ||
var context = new AuthenticationContext(adfsAuthority, false); | ||
context.acquireTokenWithUsernamePassword(response.resource, cp.username, cp.password, cp.clientId, function(err, tokenResponse) { | ||
if (!err) { | ||
upRequest.done(); | ||
assert(util.isMatchTokenResponse(response.cachedResponse, tokenResponse), 'Response did not match expected: ' + JSON.stringify(tokenResponse)); | ||
} | ||
done(err); | ||
}); | ||
}); | ||
test('managed-happy-path', function(done) { | ||
@@ -112,0 +131,0 @@ var preRequests = util.setupExpectedUserRealmResponseCommon(false); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1174785
8714
124