[auth] Added api key and basic authorization
This commit is contained in:
33
src/main/javascript/view/ApiKeyAuthView.js
Normal file
33
src/main/javascript/view/ApiKeyAuthView.js
Normal 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');
|
||||
}
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user