merge bugfixes

This commit is contained in:
AJ ONeal 2017-02-10 20:24:50 -07:00
commit 3b655720c5
2 changed files with 5 additions and 15 deletions

View File

@ -334,18 +334,16 @@
var type = 'authorization_dialog'; var type = 'authorization_dialog';
var responseType = 'token'; var responseType = 'token';
var redirectUri = opts.redirectUri; var redirectUri = opts.redirect_uri;
var scope = opts.scope || directive.authn_scope; var scope = opts.scope || directive.authn_scope;
var clientId = core.normalizeUri(opts.client_id || opts.client_uri
|| opts.appId || opts.clientId || opts.clientUri);
var args = directive[type]; var args = directive[type];
var uri = args.url; var uri = args.url;
var state = core.utils.randomState(); var state = core.utils.randomState();
var params = { var params = {
debug: opts.debug || undefined debug: opts.debug || undefined
, client_uri: opts.client_uri || opts.clientUri || undefined , client_uri: opts.client_uri || opts.clientUri || undefined
, client_id: opts.client_id || opts.client_uri || undefined
}; };
var loc;
var result; var result;
params.state = state; params.state = state;
@ -353,17 +351,9 @@
if (scope) { if (scope) {
params.scope = core.stringifyscope(scope); params.scope = core.stringifyscope(scope);
} }
if (clientId) {
// In OAuth3 client_id is optional for implicit grant
params.client_id = clientId;
}
if (!redirectUri) { if (!redirectUri) {
loc = window.location; // TODO consider making this optional
redirectUri = loc.protocol + '//' + loc.host + loc.pathname; console.error('missing redirect_uri');
if ('/' !== redirectUri[redirectUri.length - 1]) {
redirectUri += '/';
}
redirectUri += 'oauth3.html';
} }
params.redirect_uri = redirectUri; params.redirect_uri = redirectUri;

View File

@ -157,7 +157,7 @@
} }
var url = core.urls.resolve(directive.issuer, directive.grants.url) var url = core.urls.resolve(directive.issuer, directive.grants.url)
.replace(/(:azp|:client_id)/g, opts.client_id || opts.client_uri) .replace(/(:azp|:client_id)/g, core.normalizeUri(opts.client_id || opts.client_uri))
.replace(/(:sub|:account_id)/g, opts.session.meta.sub) .replace(/(:sub|:account_id)/g, opts.session.meta.sub)
; ;
var data = { var data = {