[auth]: Api key, basic authorization in main view

This commit is contained in:
Anna Bodnia
2016-03-07 21:15:04 +02:00
parent 3f92a2102a
commit 40d3161385
12 changed files with 212 additions and 158 deletions
+34
View File
@@ -0,0 +1,34 @@
'use strict';
SwaggerUi.Views.ApiKeyButton = Backbone.View.extend({ // TODO: append this to global SwaggerUi
events:{
'click .auth_submit_button' : 'applyApiKey'
},
template: Handlebars.templates.apikey_button_view,
initialize: function(opts) {
this.options = opts || {};
this.router = this.options.router;
},
render: function(){
$(this.el).html(this.template(this.model));
return this;
},
applyApiKey: function() {
var keyAuth = new SwaggerClient.ApiKeyAuthorization(
this.model.name,
this.$('.input_apiKey_entry').val(),
this.model.in
);
this.router.api.clientAuthorizations.add(this.model.name, keyAuth);
this.router.load();
//$('#apikey_container').show();
}
});