[auth] Added api key and basic authorization

This commit is contained in:
Anna Bodnia
2016-03-04 20:55:57 +02:00
parent 4fdc174ea0
commit a268d007a2
24 changed files with 547 additions and 294 deletions

View File

@@ -0,0 +1,33 @@
'use strict';
SwaggerUi.Views.ApiKeyAuthView = Backbone.View.extend({ // TODO: append this to global SwaggerUi
events: {
'change .auth_input': 'apiKeyChange'
},
template: Handlebars.templates.apikey_auth,
initialize: function(opts) {
this.options = opts || {};
this.router = this.options.router;
},
render: function (){
this.$el.html(this.template(this.model.toJSON()));
return this;
},
apiKeyChange: function (e) {
var val = $(e.target).val();
this.model.set('valid', !!val);
this.model.set('value', val);
},
isValid: function () {
return this.get('valid');
}
});