Merge pull request #1066 from mohsen1/configurable-redirecturl
Add ability to override redirectUrl in swagger-oauth
This commit is contained in:
@@ -97,6 +97,7 @@ onComplete | This is a callback function parameter which can be passed to be not
|
||||
onFailure | This is a callback function parameter which can be passed to be notified of when SwaggerUI encountered a failure was unable to render.
|
||||
highlightSizeThreshold | Any size response below this threshold will be highlighted syntactically, attempting to highlight large responses can lead to browser hangs, not including a threshold will default to highlight all returned responses.
|
||||
supportedSubmitMethods | An array of of the HTTP operations that will have the 'Try it out!` option. An empty array disables all operations. This does not filter the operations from the display.
|
||||
oauth2RedirectUrl | OAuth redirect URL
|
||||
|
||||
* All other parameters are explained in greater detail below
|
||||
|
||||
|
||||
3
dist/lib/swagger-oauth.js
vendored
3
dist/lib/swagger-oauth.js
vendored
@@ -97,7 +97,8 @@ function handleLogin() {
|
||||
var authSchemes = window.swaggerUi.api.authSchemes;
|
||||
var host = window.location;
|
||||
var pathname = location.pathname.substring(0, location.pathname.lastIndexOf("/"));
|
||||
var redirectUrl = host.protocol + '//' + host.host + pathname + '/o2c.html';
|
||||
var defaultRedirectUrl = host.protocol + '//' + host.host + pathname + '/o2c.html';
|
||||
var redirectUrl = window.oAuthRedirectUrl || defaultRedirectUrl;
|
||||
var url = null;
|
||||
|
||||
for (var key in authSchemes) {
|
||||
|
||||
4
dist/swagger-ui.js
vendored
4
dist/swagger-ui.js
vendored
@@ -38,6 +38,10 @@ window.SwaggerUi = Backbone.Router.extend({
|
||||
];
|
||||
}
|
||||
|
||||
if (typeof options.oauth2RedirectUrl === 'string') {
|
||||
window.oAuthRedirectUrl = options.redirectUrl;
|
||||
}
|
||||
|
||||
// Create an empty div which contains the dom_id
|
||||
if (! $('#' + this.dom_id).length){
|
||||
$('body').append('<div id="' + this.dom_id + '"></div>') ;
|
||||
|
||||
4
dist/swagger-ui.min.js
vendored
4
dist/swagger-ui.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -97,7 +97,8 @@ function handleLogin() {
|
||||
var authSchemes = window.swaggerUi.api.authSchemes;
|
||||
var host = window.location;
|
||||
var pathname = location.pathname.substring(0, location.pathname.lastIndexOf("/"));
|
||||
var redirectUrl = host.protocol + '//' + host.host + pathname + '/o2c.html';
|
||||
var defaultRedirectUrl = host.protocol + '//' + host.host + pathname + '/o2c.html';
|
||||
var redirectUrl = window.oAuthRedirectUrl || defaultRedirectUrl;
|
||||
var url = null;
|
||||
|
||||
for (var key in authSchemes) {
|
||||
|
||||
@@ -32,6 +32,10 @@ window.SwaggerUi = Backbone.Router.extend({
|
||||
];
|
||||
}
|
||||
|
||||
if (typeof options.oauth2RedirectUrl === 'string') {
|
||||
window.oAuthRedirectUrl = options.redirectUrl;
|
||||
}
|
||||
|
||||
// Create an empty div which contains the dom_id
|
||||
if (! $('#' + this.dom_id).length){
|
||||
$('body').append('<div id="' + this.dom_id + '"></div>') ;
|
||||
|
||||
Reference in New Issue
Block a user