[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
|
||||
// so it gets called when SwaggerApi completes loading
|
||||
render: function(){
|
||||
var authsModel;
|
||||
this.showMessage('Finished Loading Resource Information. Rendering Swagger UI...');
|
||||
this.mainView = new SwaggerUi.Views.MainView({
|
||||
model: this.api,
|
||||
@@ -18993,9 +18994,14 @@ window.SwaggerUi = Backbone.Router.extend({
|
||||
swaggerOptions: this.options,
|
||||
router: this
|
||||
}).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({
|
||||
data: SwaggerUi.utils.parseSecurityDefinitions(this.api.security),
|
||||
data: SwaggerUi.utils.parseSecurityDefinitions(authsModel),
|
||||
router: this
|
||||
});
|
||||
$('#auth_container').append(this.authView.render().el);
|
||||
|
||||
Reference in New Issue
Block a user