The list of scopes now RFC6749 Sec.3.3 compliant
See http://tools.ietf.org/html/rfc6749#section-3.3 for details. The callback url is now determined correctly if the swagger index.html file and therefore the o2c.html is not in root directory of the host. Also the popup opens more than one authorization-request-tab in firefox (seems to append the on-click js method instead of replacing it)
This commit is contained in:
@@ -48,7 +48,7 @@ function handleLogin() {
|
||||
str += '</label></li>';
|
||||
popup.append(str);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var $win = $(window),
|
||||
dw = $win.width(),
|
||||
@@ -73,8 +73,9 @@ function handleLogin() {
|
||||
popupDialog.hide();
|
||||
|
||||
var authSchemes = window.swaggerUi.api.authSchemes;
|
||||
var host = window.location;
|
||||
var redirectUrl = host.protocol + '//' + host.host + "/o2c.html";
|
||||
var location = window.location;
|
||||
var locationUrl = location.protocol + '//' + location.host + location.pathname;
|
||||
var redirectUrl = locationUrl.replace("index.html","").concat("/o2c.html").replace("//o2c.html","/o2c.html");
|
||||
var url = null;
|
||||
|
||||
var p = window.swaggerUi.api.authSchemes;
|
||||
@@ -90,23 +91,29 @@ function handleLogin() {
|
||||
}
|
||||
}
|
||||
}
|
||||
var scopes = []
|
||||
var scopes = [];
|
||||
var scopeForUrl='';
|
||||
var o = $('.api-popup-scopes').find('input:checked');
|
||||
|
||||
for(k =0; k < o.length; k++) {
|
||||
for(var k =0; k < o.length; k++) {
|
||||
scopes.push($(o[k]).attr("scope"));
|
||||
if(k > 0){
|
||||
scopeForUrl+=' ';
|
||||
}
|
||||
scopeForUrl+=$(o[k]).attr("scope");
|
||||
}
|
||||
|
||||
window.enabledScopes=scopes;
|
||||
|
||||
|
||||
url += '&redirect_uri=' + encodeURIComponent(redirectUrl);
|
||||
url += '&realm=' + encodeURIComponent(realm);
|
||||
url += '&client_id=' + encodeURIComponent(clientId);
|
||||
url += '&scope=' + encodeURIComponent(scopes);
|
||||
url += '&scope=' + encodeURIComponent(scopeForUrl);
|
||||
|
||||
window.open(url);
|
||||
});
|
||||
|
||||
}
|
||||
popupMask.show();
|
||||
popupDialog.show();
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user