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

Commit 2e357e3

Browse files
authored
Merge pull request #223 from AzureAD/dev
0.2.0
2 parents b7a6745 + 84fdeea commit 2e357e3

File tree

6 files changed

+434
-84
lines changed

6 files changed

+434
-84
lines changed

README.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ You can find the changes for each version in the [change log](https://github.com
1212

1313
## Community Help and Support
1414

15-
We leverage [Stack Overflow](http://stackoverflow.com/) to work with the community on supporting Azure Active Directory and its SDKs, including this one! We highly recommend you ask your questions on Stack Overflow (we're all on there!) Also browser existing issues to see if someone has had your question before.
15+
We leverage [Stack Overflow](http://stackoverflow.com/) to work with the community on supporting Azure Active Directory and its SDKs, including this one! We highly recommend you ask your questions on Stack Overflow (we're all on there!) Also browse existing issues to see if someone has had your question before.
1616

1717
We recommend you use the "adal" tag so we can see it! Here is the latest Q&A on Stack Overflow for ADAL: [http://stackoverflow.com/questions/tagged/adal](http://stackoverflow.com/questions/tagged/adal)
1818

@@ -31,15 +31,29 @@ All code is licensed under the Apache 2.0 license and we triage actively on GitH
3131

3232
### Configure the logging
3333

34+
#### Personal Identifiable Information (PII) & Organizational Identifiable Information (OII)
35+
36+
By default, ADAL logging does not capture or log any PII or OII. The library allows app developers to turn this on by configuring the `loggingWithPII` flag in the logging options. By turning on PII or OII, the app takes responsibility for safely handling highly-sensitive data and complying with any regulatory requirements.
37+
3438
```javascript
3539
var logging = require('adal-node').Logging;
3640

41+
//PII or OII logging disabled. Default Logger does not capture any PII or OII.
3742
logging.setLoggingOptions({
3843
log: function(level, message, error) {
3944
// provide your own implementation of the log function
4045
},
4146
level: logging.LOGGING_LEVEL.VERBOSE, // provide the logging level
42-
loggingWithPII: false // Determine if you want to log personal identitification information. The default value is false.
47+
loggingWithPII: false // Determine if you want to log personal identification information. The default value is false.
48+
});
49+
50+
//PII or OII logging enabled.
51+
logging.setLoggingOptions({
52+
log: function(level, message, error) {
53+
// provide your own implementation of the log function
54+
},
55+
level: logging.LOGGING_LEVEL.VERBOSE,
56+
loggingWithPII: true
4357
});
4458
```
4559

lib/authentication-context.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,11 @@ var globalCache = new MemoryCache();
8686
* construction of other AuthenticationContexts.
8787
*
8888
*/
89-
function AuthenticationContext(authority, validateAuthority, cache) {
89+
function AuthenticationContext(authority, validateAuthority, cache, aadApiVersion) {
9090
var validate = (validateAuthority === undefined || validateAuthority === null || validateAuthority);
9191

9292
this._authority = new Authority(authority, validate);
93+
this._authority.aadApiVersion = aadApiVersion;
9394
this._oauth2client = null;
9495
this._correlationId = null;
9596
this._callContext = { options : globalADALOptions };

lib/oauth2client.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ DEVICE_CODE_RESPONSE_MAP[DeviceCodeResponseParameters.ERROR_DESCRIPTION] = UserC
7070
* @param {string|url} authority An url that points to an authority.
7171
*/
7272
function OAuth2Client(callContext, authority) {
73+
this._aadApiVersion = authority.aadApiVersion === undefined? '1.0' : authority.aadApiVersion;
7374
this._tokenEndpoint = authority.tokenEndpoint;
7475
this._deviceCodeEndpoint = authority.deviceCodeEndpoint;
7576

@@ -87,7 +88,7 @@ OAuth2Client.prototype._createTokenUrl = function () {
8788
var tokenUrl = url.parse(this._tokenEndpoint);
8889

8990
var parameters = {};
90-
parameters[OAuth2Parameters.AAD_API_VERSION] = '1.0';
91+
parameters[OAuth2Parameters.AAD_API_VERSION] = this._aadApiVersion;
9192

9293
tokenUrl.search = querystring.stringify(parameters);
9394
return tokenUrl;
@@ -102,7 +103,7 @@ OAuth2Client.prototype._createDeviceCodeUrl = function () {
102103
var deviceCodeUrl = url.parse(this._deviceCodeEndpoint);
103104

104105
var parameters = {};
105-
parameters[OAuth2Parameters.AAD_API_VERSION] = '1.0';
106+
parameters[OAuth2Parameters.AAD_API_VERSION] = this._aadApiVersion;
106107

107108
deviceCodeUrl.search = querystring.stringify(parameters);
108109

lib/token-request.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,9 +584,10 @@ TokenRequest.prototype.getTokenWithDeviceCode = function(userCodeInfo, callback)
584584

585585
var interval = userCodeInfo[DeviceCodeResponseParameters.INTERVAL];
586586
var expires_in = userCodeInfo[DeviceCodeResponseParameters.EXPIRES_IN];
587-
587+
588588
if (interval <= 0) {
589589
callback(new Error('invalid refresh interval'));
590+
return;
590591
}
591592

592593
this._oauthGetTokenByPolling(oauthParameters, interval, expires_in, function(err, tokenResponse) {

0 commit comments

Comments
 (0)