diff --git a/dist/index.html b/dist/index.html index 0cea26e5..770618a3 100644 --- a/dist/index.html +++ b/dist/index.html @@ -49,7 +49,8 @@ clientId: "your-client-id", clientSecret: "your-client-secret", realm: "your-realms", - appName: "your-app-name" + appName: "your-app-name", + scopeSeparator: "," }); } diff --git a/dist/lib/swagger-oauth.js b/dist/lib/swagger-oauth.js index f1ac074e..3bf32647 100644 --- a/dist/lib/swagger-oauth.js +++ b/dist/lib/swagger-oauth.js @@ -6,6 +6,7 @@ var realm; var oauth2KeyName; var redirect_uri; var clientSecret; +var scopeSeparator; function handleLogin() { var scopes = []; @@ -153,7 +154,7 @@ function handleLogin() { url += '&redirect_uri=' + encodeURIComponent(redirectUrl); url += '&realm=' + encodeURIComponent(realm); url += '&client_id=' + encodeURIComponent(clientId); - url += '&scope=' + encodeURIComponent(scopes.join(' ')); + url += '&scope=' + encodeURIComponent(scopes.join(scopeSeparator)); url += '&state=' + encodeURIComponent(state); window.open(url); @@ -188,6 +189,7 @@ function initOAuth(opts) { clientId = (o.clientId||errors.push('missing client id')); clientSecret = (o.clientSecret||errors.push('missing client secret')); realm = (o.realm||errors.push('missing realm')); + scopeSeparator = (o.scopeSeparator||' '); if(errors.length > 0){ log('auth unable initialize oauth: ' + errors); diff --git a/lib/swagger-oauth.js b/lib/swagger-oauth.js index f1ac074e..3bf32647 100644 --- a/lib/swagger-oauth.js +++ b/lib/swagger-oauth.js @@ -6,6 +6,7 @@ var realm; var oauth2KeyName; var redirect_uri; var clientSecret; +var scopeSeparator; function handleLogin() { var scopes = []; @@ -153,7 +154,7 @@ function handleLogin() { url += '&redirect_uri=' + encodeURIComponent(redirectUrl); url += '&realm=' + encodeURIComponent(realm); url += '&client_id=' + encodeURIComponent(clientId); - url += '&scope=' + encodeURIComponent(scopes.join(' ')); + url += '&scope=' + encodeURIComponent(scopes.join(scopeSeparator)); url += '&state=' + encodeURIComponent(state); window.open(url); @@ -188,6 +189,7 @@ function initOAuth(opts) { clientId = (o.clientId||errors.push('missing client id')); clientSecret = (o.clientSecret||errors.push('missing client secret')); realm = (o.realm||errors.push('missing realm')); + scopeSeparator = (o.scopeSeparator||' '); if(errors.length > 0){ log('auth unable initialize oauth: ' + errors); diff --git a/src/main/html/index.html b/src/main/html/index.html index 0cea26e5..770618a3 100644 --- a/src/main/html/index.html +++ b/src/main/html/index.html @@ -49,7 +49,8 @@ clientId: "your-client-id", clientSecret: "your-client-secret", realm: "your-realms", - appName: "your-app-name" + appName: "your-app-name", + scopeSeparator: "," }); }