Merge pull request #1648 from estiller/master
Support additional query parameters during OAuth2 authorization process
This commit is contained in:
3
dist/index.html
vendored
3
dist/index.html
vendored
@@ -51,7 +51,8 @@
|
|||||||
clientSecret: "your-client-secret-if-required",
|
clientSecret: "your-client-secret-if-required",
|
||||||
realm: "your-realms",
|
realm: "your-realms",
|
||||||
appName: "your-app-name",
|
appName: "your-app-name",
|
||||||
scopeSeparator: ","
|
scopeSeparator: ",",
|
||||||
|
additionalQueryStringParams: {}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
5
dist/lib/swagger-oauth.js
vendored
5
dist/lib/swagger-oauth.js
vendored
@@ -7,6 +7,7 @@ var oauth2KeyName;
|
|||||||
var redirect_uri;
|
var redirect_uri;
|
||||||
var clientSecret;
|
var clientSecret;
|
||||||
var scopeSeparator;
|
var scopeSeparator;
|
||||||
|
var additionalQueryStringParams;
|
||||||
|
|
||||||
function handleLogin() {
|
function handleLogin() {
|
||||||
var scopes = [];
|
var scopes = [];
|
||||||
@@ -156,6 +157,9 @@ function handleLogin() {
|
|||||||
url += '&client_id=' + encodeURIComponent(clientId);
|
url += '&client_id=' + encodeURIComponent(clientId);
|
||||||
url += '&scope=' + encodeURIComponent(scopes.join(scopeSeparator));
|
url += '&scope=' + encodeURIComponent(scopes.join(scopeSeparator));
|
||||||
url += '&state=' + encodeURIComponent(state);
|
url += '&state=' + encodeURIComponent(state);
|
||||||
|
for (var key in additionalQueryStringParams) {
|
||||||
|
url += '&' + key + '=' + encodeURIComponent(additionalQueryStringParams[key]);
|
||||||
|
}
|
||||||
|
|
||||||
window.open(url);
|
window.open(url);
|
||||||
});
|
});
|
||||||
@@ -190,6 +194,7 @@ function initOAuth(opts) {
|
|||||||
clientSecret = (o.clientSecret||null);
|
clientSecret = (o.clientSecret||null);
|
||||||
realm = (o.realm||errors.push('missing realm'));
|
realm = (o.realm||errors.push('missing realm'));
|
||||||
scopeSeparator = (o.scopeSeparator||' ');
|
scopeSeparator = (o.scopeSeparator||' ');
|
||||||
|
additionalQueryStringParams = (o.additionalQueryStringParams||{});
|
||||||
|
|
||||||
if(errors.length > 0){
|
if(errors.length > 0){
|
||||||
log('auth unable initialize oauth: ' + errors);
|
log('auth unable initialize oauth: ' + errors);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ var oauth2KeyName;
|
|||||||
var redirect_uri;
|
var redirect_uri;
|
||||||
var clientSecret;
|
var clientSecret;
|
||||||
var scopeSeparator;
|
var scopeSeparator;
|
||||||
|
var additionalQueryStringParams;
|
||||||
|
|
||||||
function handleLogin() {
|
function handleLogin() {
|
||||||
var scopes = [];
|
var scopes = [];
|
||||||
@@ -156,6 +157,9 @@ function handleLogin() {
|
|||||||
url += '&client_id=' + encodeURIComponent(clientId);
|
url += '&client_id=' + encodeURIComponent(clientId);
|
||||||
url += '&scope=' + encodeURIComponent(scopes.join(scopeSeparator));
|
url += '&scope=' + encodeURIComponent(scopes.join(scopeSeparator));
|
||||||
url += '&state=' + encodeURIComponent(state);
|
url += '&state=' + encodeURIComponent(state);
|
||||||
|
for (var key in additionalQueryStringParams) {
|
||||||
|
url += '&' + key + '=' + encodeURIComponent(additionalQueryStringParams[key]);
|
||||||
|
}
|
||||||
|
|
||||||
window.open(url);
|
window.open(url);
|
||||||
});
|
});
|
||||||
@@ -190,6 +194,7 @@ function initOAuth(opts) {
|
|||||||
clientSecret = (o.clientSecret||null);
|
clientSecret = (o.clientSecret||null);
|
||||||
realm = (o.realm||errors.push('missing realm'));
|
realm = (o.realm||errors.push('missing realm'));
|
||||||
scopeSeparator = (o.scopeSeparator||' ');
|
scopeSeparator = (o.scopeSeparator||' ');
|
||||||
|
additionalQueryStringParams = (o.additionalQueryStringParams||{});
|
||||||
|
|
||||||
if(errors.length > 0){
|
if(errors.length > 0){
|
||||||
log('auth unable initialize oauth: ' + errors);
|
log('auth unable initialize oauth: ' + errors);
|
||||||
|
|||||||
@@ -51,7 +51,8 @@
|
|||||||
clientSecret: "your-client-secret-if-required",
|
clientSecret: "your-client-secret-if-required",
|
||||||
realm: "your-realms",
|
realm: "your-realms",
|
||||||
appName: "your-app-name",
|
appName: "your-app-name",
|
||||||
scopeSeparator: ","
|
scopeSeparator: ",",
|
||||||
|
additionalQueryStringParams: {}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user