@@ -67,6 +67,15 @@ <h1 class="page-title">authentication/index.js</h1>
67
67
* @see {@link https://auth0.com/docs/api/authentication}
68
68
*/
69
69
function Authentication(auth0, options) {
70
+ // If we have two arguments, the first one is a WebAuth instance, so we assign that
71
+ // if not, it's an options object and then we should use that as options instead
72
+ // this is here because we don't want to break people coming from v8
73
+ if (arguments.length === 2) {
74
+ this.auth0 = auth0;
75
+ } else {
76
+ options = auth0;
77
+ }
78
+
70
79
/* eslint-disable */
71
80
assert.check(
72
81
options,
@@ -99,7 +108,6 @@ <h1 class="page-title">authentication/index.js</h1>
99
108
/* eslint-enable */
100
109
101
110
this.baseOptions = options;
102
- this.auth0 = auth0;
103
111
this.baseOptions._sendTelemetry = this.baseOptions._sendTelemetry === false
104
112
? this.baseOptions._sendTelemetry
105
113
: true;
@@ -180,8 +188,14 @@ <h1 class="page-title">authentication/index.js</h1>
180
188
params.connection_scope = params.connection_scope.join(',');
181
189
}
182
190
191
+ params = objectHelper.blacklist(params, [
192
+ 'username',
193
+ 'popupOptions',
194
+ 'domain',
195
+ 'tenant',
196
+ 'timeout'
197
+ ]);
183
198
params = objectHelper.toSnakeCase(params, ['auth0Client']);
184
- params = objectHelper.blacklist(params, ['username']);
185
199
params = parametersWhitelist.oauthAuthorizeParams(this.warn, params);
186
200
187
201
qString = qs.stringify(params);
@@ -222,7 +236,15 @@ <h1 class="page-title">authentication/index.js</h1>
222
236
223
237
params = objectHelper.toSnakeCase(params, ['auth0Client', 'returnTo']);
224
238
225
- qString = qs.stringify(params);
239
+ qString = qs.stringify(objectHelper.blacklist(params, ['federated']));
240
+ if (
241
+ options &&
242
+ options.federated !== undefined &&
243
+ options.federated !== false &&
244
+ options.federated !== 'false'
245
+ ) {
246
+ qString += '&federated';
247
+ }
226
248
227
249
return urljoin(this.baseOptions.rootUrl, 'v2', 'logout', '?' + qString);
228
250
};
@@ -338,8 +360,6 @@ <h1 class="page-title">authentication/index.js</h1>
338
360
body = objectHelper.toSnakeCase(body, ['auth0Client']);
339
361
body = parametersWhitelist.oauthTokenParams(this.warn, body);
340
362
341
- body.grant_type = body.grant_type;
342
-
343
363
return this.request.post(url).send(body).end(responseHandler(cb));
344
364
};
345
365
@@ -396,6 +416,12 @@ <h1 class="page-title">authentication/index.js</h1>
396
416
* @param {Function} cb
397
417
*/
398
418
Authentication.prototype.getSSOData = function(withActiveDirectories, cb) {
419
+ /* istanbul ignore if */
420
+ if (!this.auth0) {
421
+ // we can't import this in the constructor because it'd be a ciclic dependency
422
+ var WebAuth = require('../web-auth/index'); // eslint-disable-line
423
+ this.auth0 = new WebAuth(this.baseOptions);
424
+ }
399
425
if (typeof withActiveDirectories === 'function') {
400
426
cb = withActiveDirectories;
401
427
}
@@ -542,7 +568,7 @@ <h1 class="page-title">authentication/index.js</h1>
542
568
< br class ="clear ">
543
569
544
570
< footer >
545
- Generated by < a href ="https://github.com/jsdoc3/jsdoc "> JSDoc 3.6.0</ a > on Tue Dec 26 2017 16:09:39 GMT-0200 (-02 ) using the Minami theme.
571
+ Generated by < a href ="https://github.com/jsdoc3/jsdoc "> JSDoc 3.6.0</ a > on Thu Feb 22 2018 17:45:54 GMT-0300 (-03 ) using the Minami theme.
546
572
</ footer >
547
573
548
574
< script > prettyPrint ( ) ; </ script >
0 commit comments