[auth] added support of oauth2 in security popup
This commit is contained in:
@@ -12,7 +12,9 @@ SwaggerUi.Views.AuthButtonView = Backbone.View.extend({
|
||||
|
||||
initialize: function(opts) {
|
||||
this.options = opts || {};
|
||||
this.options.data = this.options.data || {};
|
||||
this.router = this.options.router;
|
||||
this.auths = this.options.data.auths;
|
||||
},
|
||||
|
||||
render: function () {
|
||||
@@ -28,7 +30,7 @@ SwaggerUi.Views.AuthButtonView = Backbone.View.extend({
|
||||
|
||||
authsModel = {
|
||||
title: 'Available authorizations',
|
||||
content: this.renderAuths(this.model.auths)
|
||||
content: this.renderAuths(this.auths)
|
||||
};
|
||||
|
||||
this.popup = new SwaggerUi.Views.PopupView({model: authsModel});
|
||||
|
||||
@@ -258,10 +258,10 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
|
||||
}
|
||||
|
||||
if (Array.isArray(this.model.security)) {
|
||||
var authsModel = { auths: SwaggerUi.utils.parseSecurityDefinitions(this.model.security) };
|
||||
var authsModel = SwaggerUi.utils.parseSecurityDefinitions(this.model.security);
|
||||
|
||||
authsModel.isLogout = !_.isEmpty(window.swaggerUi.api.clientAuthorizations.authz);
|
||||
this.authView = new SwaggerUi.Views.AuthButtonView({model: authsModel, router: this.router});
|
||||
this.authView = new SwaggerUi.Views.AuthButtonView({data: authsModel, router: this.router});
|
||||
this.$('.authorize-wrapper').append(this.authView.render().el);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user