[auth] show securityDefinitions when clicking on authorize in header
This commit is contained in:
10
dist/swagger-ui.js
vendored
10
dist/swagger-ui.js
vendored
@@ -18986,6 +18986,7 @@ window.SwaggerUi = Backbone.Router.extend({
|
|||||||
// This is bound to success handler for SwaggerApi
|
// This is bound to success handler for SwaggerApi
|
||||||
// so it gets called when SwaggerApi completes loading
|
// so it gets called when SwaggerApi completes loading
|
||||||
render: function(){
|
render: function(){
|
||||||
|
var authsModel;
|
||||||
this.showMessage('Finished Loading Resource Information. Rendering Swagger UI...');
|
this.showMessage('Finished Loading Resource Information. Rendering Swagger UI...');
|
||||||
this.mainView = new SwaggerUi.Views.MainView({
|
this.mainView = new SwaggerUi.Views.MainView({
|
||||||
model: this.api,
|
model: this.api,
|
||||||
@@ -18993,9 +18994,14 @@ window.SwaggerUi = Backbone.Router.extend({
|
|||||||
swaggerOptions: this.options,
|
swaggerOptions: this.options,
|
||||||
router: this
|
router: this
|
||||||
}).render();
|
}).render();
|
||||||
if (!_.isEmpty(this.api.security)){
|
if (!_.isEmpty(this.api.securityDefinitions)){
|
||||||
|
authsModel = _.map(this.api.securityDefinitions, function (auth, name) {
|
||||||
|
var result = {};
|
||||||
|
result[name] = auth;
|
||||||
|
return result;
|
||||||
|
});
|
||||||
this.authView = new SwaggerUi.Views.AuthButtonView({
|
this.authView = new SwaggerUi.Views.AuthButtonView({
|
||||||
data: SwaggerUi.utils.parseSecurityDefinitions(this.api.security),
|
data: SwaggerUi.utils.parseSecurityDefinitions(authsModel),
|
||||||
router: this
|
router: this
|
||||||
});
|
});
|
||||||
$('#auth_container').append(this.authView.render().el);
|
$('#auth_container').append(this.authView.render().el);
|
||||||
|
|||||||
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
@@ -137,6 +137,7 @@ window.SwaggerUi = Backbone.Router.extend({
|
|||||||
// This is bound to success handler for SwaggerApi
|
// This is bound to success handler for SwaggerApi
|
||||||
// so it gets called when SwaggerApi completes loading
|
// so it gets called when SwaggerApi completes loading
|
||||||
render: function(){
|
render: function(){
|
||||||
|
var authsModel;
|
||||||
this.showMessage('Finished Loading Resource Information. Rendering Swagger UI...');
|
this.showMessage('Finished Loading Resource Information. Rendering Swagger UI...');
|
||||||
this.mainView = new SwaggerUi.Views.MainView({
|
this.mainView = new SwaggerUi.Views.MainView({
|
||||||
model: this.api,
|
model: this.api,
|
||||||
@@ -144,9 +145,14 @@ window.SwaggerUi = Backbone.Router.extend({
|
|||||||
swaggerOptions: this.options,
|
swaggerOptions: this.options,
|
||||||
router: this
|
router: this
|
||||||
}).render();
|
}).render();
|
||||||
if (!_.isEmpty(this.api.security)){
|
if (!_.isEmpty(this.api.securityDefinitions)){
|
||||||
|
authsModel = _.map(this.api.securityDefinitions, function (auth, name) {
|
||||||
|
var result = {};
|
||||||
|
result[name] = auth;
|
||||||
|
return result;
|
||||||
|
});
|
||||||
this.authView = new SwaggerUi.Views.AuthButtonView({
|
this.authView = new SwaggerUi.Views.AuthButtonView({
|
||||||
data: SwaggerUi.utils.parseSecurityDefinitions(this.api.security),
|
data: SwaggerUi.utils.parseSecurityDefinitions(authsModel),
|
||||||
router: this
|
router: this
|
||||||
});
|
});
|
||||||
$('#auth_container').append(this.authView.render().el);
|
$('#auth_container').append(this.authView.render().el);
|
||||||
|
|||||||
Reference in New Issue
Block a user