updated key name
This commit is contained in:
@@ -48,72 +48,65 @@ function handleLogin() {
|
|||||||
str += '</label></li>';
|
str += '</label></li>';
|
||||||
popup.append(str);
|
popup.append(str);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var $win = $(window),
|
var $win = $(window),
|
||||||
dw = $win.width(),
|
dw = $win.width(),
|
||||||
dh = $win.height(),
|
dh = $win.height(),
|
||||||
st = $win.scrollTop(),
|
st = $win.scrollTop(),
|
||||||
dlgWd = popupDialog.outerWidth(),
|
dlgWd = popupDialog.outerWidth(),
|
||||||
dlgHt = popupDialog.outerHeight(),
|
dlgHt = popupDialog.outerHeight(),
|
||||||
top = (dh -dlgHt)/2 + st,
|
top = (dh -dlgHt)/2 + st,
|
||||||
left = (dw - dlgWd)/2;
|
left = (dw - dlgWd)/2;
|
||||||
|
|
||||||
popupDialog.css({
|
popupDialog.css({
|
||||||
top: (top < 0? 0 : top) + 'px',
|
top: (top < 0? 0 : top) + 'px',
|
||||||
left: (left < 0? 0 : left) + 'px'
|
left: (left < 0? 0 : left) + 'px'
|
||||||
});
|
});
|
||||||
|
|
||||||
popupDialog.find('button.api-popup-cancel').click(function() {
|
popupDialog.find('button.api-popup-cancel').click(function() {
|
||||||
popupMask.hide();
|
popupMask.hide();
|
||||||
popupDialog.hide();
|
popupDialog.hide();
|
||||||
});
|
});
|
||||||
popupDialog.find('button.api-popup-authbtn').click(function() {
|
popupDialog.find('button.api-popup-authbtn').click(function() {
|
||||||
popupMask.hide();
|
popupMask.hide();
|
||||||
popupDialog.hide();
|
popupDialog.hide();
|
||||||
|
|
||||||
var authSchemes = window.swaggerUi.api.authSchemes;
|
var authSchemes = window.swaggerUi.api.authSchemes;
|
||||||
var location = window.location;
|
var host = window.location;
|
||||||
var locationUrl = location.protocol + '//' + location.host + location.pathname;
|
var redirectUrl = host.protocol + '//' + host.host + "/o2c.html";
|
||||||
var redirectUrl = locationUrl.replace("index.html","").concat("/o2c.html").replace("//o2c.html","/o2c.html");
|
var url = null;
|
||||||
var url = null;
|
|
||||||
|
|
||||||
var p = window.swaggerUi.api.authSchemes;
|
var p = window.swaggerUi.api.authSchemes;
|
||||||
for (var key in p) {
|
for (var key in p) {
|
||||||
if (p.hasOwnProperty(key)) {
|
if (p.hasOwnProperty(key)) {
|
||||||
var o = p[key].grantTypes;
|
var o = p[key].grantTypes;
|
||||||
for(var t in o) {
|
for(var t in o) {
|
||||||
if(o.hasOwnProperty(t) && t === 'implicit') {
|
if(o.hasOwnProperty(t) && t === 'implicit') {
|
||||||
var dets = o[t];
|
var dets = o[t];
|
||||||
url = dets.loginEndpoint.url + "?response_type=token";
|
url = dets.loginEndpoint.url + "?response_type=token";
|
||||||
window.swaggerUi.tokenName = dets.tokenName;
|
window.swaggerUi.tokenName = dets.tokenName;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var scopes = [];
|
}
|
||||||
var scopeForUrl='';
|
var scopes = []
|
||||||
var o = $('.api-popup-scopes').find('input:checked');
|
var o = $('.api-popup-scopes').find('input:checked');
|
||||||
|
|
||||||
for(var k =0; k < o.length; k++) {
|
for(k =0; k < o.length; k++) {
|
||||||
scopes.push($(o[k]).attr("scope"));
|
scopes.push($(o[k]).attr("scope"));
|
||||||
if(k > 0){
|
}
|
||||||
scopeForUrl+=' ';
|
|
||||||
}
|
|
||||||
scopeForUrl+=$(o[k]).attr("scope");
|
|
||||||
}
|
|
||||||
|
|
||||||
window.enabledScopes=scopes;
|
window.enabledScopes=scopes;
|
||||||
|
|
||||||
|
|
||||||
url += '&redirect_uri=' + encodeURIComponent(redirectUrl);
|
url += '&redirect_uri=' + encodeURIComponent(redirectUrl);
|
||||||
url += '&realm=' + encodeURIComponent(realm);
|
url += '&realm=' + encodeURIComponent(realm);
|
||||||
url += '&client_id=' + encodeURIComponent(clientId);
|
url += '&client_id=' + encodeURIComponent(clientId);
|
||||||
url += '&scope=' + encodeURIComponent(scopeForUrl);
|
url += '&scope=' + encodeURIComponent(scopes);
|
||||||
|
|
||||||
|
window.open(url);
|
||||||
|
});
|
||||||
|
|
||||||
window.open(url);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
popupMask.show();
|
popupMask.show();
|
||||||
popupDialog.show();
|
popupDialog.show();
|
||||||
return;
|
return;
|
||||||
@@ -211,7 +204,7 @@ function onOAuthComplete(token) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
window.authorizations.add("key", new ApiKeyAuthorization("Authorization", "Bearer " + b, "header"));
|
window.authorizations.add("oauth2", new ApiKeyAuthorization("Authorization", "Bearer " + b, "header"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user