diff --git a/dist/css/print.css b/dist/css/print.css
index 1ba0e11e..28080d10 100644
--- a/dist/css/print.css
+++ b/dist/css/print.css
@@ -1203,7 +1203,8 @@
color: #999999;
margin-bottom: 5px;
}
-.swagger-section .auth_container .auth_submit__button {
+.swagger-section .auth_container .auth_submit__button,
+.swagger-section .auth_container .auth_logout__button {
color: #547f00;
border: none;
text-decoration: underline;
@@ -1211,6 +1212,7 @@
padding-left: 0;
font-size: 1em;
cursor: pointer;
+ outline: none;
}
.swagger-section .auth_container .key_input_container {
margin-bottom: 15px;
diff --git a/dist/css/screen.css b/dist/css/screen.css
index 753a25de..99557907 100644
--- a/dist/css/screen.css
+++ b/dist/css/screen.css
@@ -1203,7 +1203,8 @@
color: #999999;
margin-bottom: 5px;
}
-.swagger-section .auth_container .auth_submit__button {
+.swagger-section .auth_container .auth_submit__button,
+.swagger-section .auth_container .auth_logout__button {
color: #547f00;
border: none;
text-decoration: underline;
@@ -1211,6 +1212,7 @@
padding-left: 0;
font-size: 1em;
cursor: pointer;
+ outline: none;
}
.swagger-section .auth_container .key_input_container {
margin-bottom: 15px;
diff --git a/dist/index.html b/dist/index.html
index d95471a1..7c5f45e9 100644
--- a/dist/index.html
+++ b/dist/index.html
@@ -36,7 +36,7 @@
if (url && url.length > 1) {
url = decodeURIComponent(url[1]);
} else {
- url = "http://petstore.swagger.io/v2/swagger.json";
+ url = "http://localhost:3001/swagger.json";
}
hljs.configure({
diff --git a/dist/swagger-ui.js b/dist/swagger-ui.js
index 5d393afc..1cd933d6 100644
--- a/dist/swagger-ui.js
+++ b/dist/swagger-ui.js
@@ -6,15 +6,31 @@
*/
(function(){this["Handlebars"] = this["Handlebars"] || {};
this["Handlebars"]["templates"] = this["Handlebars"]["templates"] || {};
-this["Handlebars"]["templates"]["apikey_button_view"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
+this["Handlebars"]["templates"]["apikey_button_view"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
- return "
\n
\n
"
+ return " "
+ + escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
+ + "\n";
+},"3":function(depth0,helpers,partials,data) {
+ return " \n";
+ },"5":function(depth0,helpers,partials,data) {
+ return "
\n";
+ },"7":function(depth0,helpers,partials,data) {
+ return "
\n";
+ },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
+ var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "
\n";
+ + " =\n";
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isLogout : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(3, data),"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ buffer += "
\n";
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isLogout : depth0), {"name":"if","hash":{},"fn":this.program(5, data),"inverse":this.program(7, data),"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ return buffer + "
\n\n";
},"useData":true});
this["Handlebars"]["templates"]["auth_button"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
return " ');
//todo refactor, copy-pasted from MainView.js
- for (name in this.model.auths) {
- auth = this.model.auths[name];
+ for (name in auths) {
+ auth = auths[name];
if (auth.type === 'apiKey') {
- authEl = new SwaggerUi.Views.ApiKeyButton({model: auth, router: this.router}).render().el;
+ authEl = new SwaggerUi.Views.ApiKeyButton({model: auth, router: this.router}).render().el;
el.append(authEl);
} else if (auth.type === 'basic' && el.find('.basic_auth_container').length === 0) {
authEl = new SwaggerUi.Views.BasicAuthButton({model: auth, router: this.router}).render().el;
@@ -25125,16 +25147,40 @@ SwaggerUi.Views.AuthView = Backbone.View.extend({
logoutClick: function (e) {
var authsModel;
+
e.preventDefault();
authsModel = {
- title: 'Logout authorizations'
+ title: 'Logout authorizations',
+ content: this.renderAuths(this.getAuthMap())
};
this.popup = new SwaggerUi.Views.PopupView({model: authsModel});
this.popup.render();
+ },
- console.log(window.swaggerUi.api.clientAuthorizations.authz);
+ getAuthMap: function () {
+ var authsMap = {};
+
+ _.forEach(window.swaggerUi.api.clientAuthorizations.authz, function (value, key) {
+ if (key === 'basic') {
+ authsMap.basic = {
+ type: key,
+ isLogout: true,
+ name: key
+ };
+ } else {
+ authsMap[key] = {
+ type: 'apiKey',
+ 'in': value.type,
+ value: value.value,
+ isLogout: true,
+ name: key
+ };
+ }
+ });
+
+ return authsMap;
}
});
@@ -25158,7 +25204,8 @@ SwaggerUi.Views.BasicAuthButton = Backbone.View.extend({
},
events: {
- 'submit .key_input_container' : 'applyPassword'
+ 'submit .key_input_container' : 'applyPassword',
+ 'click .auth_logout__button' : 'clickLogout'
},
applyPassword: function(event) {
@@ -25168,6 +25215,11 @@ SwaggerUi.Views.BasicAuthButton = Backbone.View.extend({
var basicAuth = new SwaggerClient.PasswordAuthorization('basic', username, password);
this.router.api.clientAuthorizations.add(this.model.type, basicAuth);
this.router.load();
+ },
+
+ clickLogout: function () {
+ window.swaggerUi.api.clientAuthorizations.remove(this.model.name);
+ this.remove();
}
});
@@ -25196,7 +25248,7 @@ SwaggerUi.Views.HeaderView = Backbone.View.extend({
showPetStore: function(){
this.trigger('update-swagger-ui', {
- url:'http://petstore.swagger.io/v2/swagger.json'
+ url:'http://localhost:3001/swagger.json'
});
},
diff --git a/dist/swagger-ui.min.js b/dist/swagger-ui.min.js
index cc926be3..f37c48c8 100644
--- a/dist/swagger-ui.min.js
+++ b/dist/swagger-ui.min.js
@@ -1,11 +1,11 @@
-(function(){function e(){e.history=e.history||[],e.history.push(arguments),this.console&&console.log(Array.prototype.slice.call(arguments)[0])}this.Handlebars=this.Handlebars||{},this.Handlebars.templates=this.Handlebars.templates||{},this.Handlebars.templates.apikey_button_view=Handlebars.template({compiler:[6,">= 2.0.0-beta.1"],main:function(e,t,n,r){var i,a="function",s=t.helperMissing,o=this.escapeExpression;return"
\n"},useData:!0}),this.Handlebars.templates.auth_button=Handlebars.template({1:function(e,t,n,r){return"
Log out\n"},compiler:[6,">= 2.0.0-beta.1"],main:function(e,t,n,r){var i,a="
Click to Authorize\n";return i=t["if"].call(e,null!=e?e.isLogout:e,{name:"if",hash:{},fn:this.program(1,r),inverse:this.noop,data:r}),null!=i&&(a+=i),a},useData:!0}),this.Handlebars.templates.basic_auth_button_view=Handlebars.template({compiler:[6,">= 2.0.0-beta.1"],main:function(e,t,n,r){var i,a="function",s=t.helperMissing,o=this.escapeExpression;return'
\n
Basic authentication
\n
\n
\n\n'},useData:!0}),this.Handlebars.templates.content_type=Handlebars.template({1:function(e,t,n,r){var i,a="";return i=t.each.call(e,null!=e?e.produces:e,{name:"each",hash:{},fn:this.program(2,r),inverse:this.noop,data:r}),null!=i&&(a+=i),a},2:function(e,t,n,r){var i=this.lambda,a=this.escapeExpression;return'
\n"},4:function(e,t,n,r){return'
\n'},compiler:[6,">= 2.0.0-beta.1"],main:function(e,t,n,r){var i,a,s="function",o=t.helperMissing,u=this.escapeExpression,l='
\n
\n"},useData:!0}),$(function(){$.fn.vAlign=function(){return this.each(function(){var e=$(this).height(),t=$(this).parent().height(),n=(t-e)/2;$(this).css("margin-top",n)})},$.fn.stretchFormtasticInputWidthToParent=function(){return this.each(function(){var e=$(this).closest("form").innerWidth(),t=parseInt($(this).closest("form").css("padding-left"),10)+parseInt($(this).closest("form").css("padding-right"),10),n=parseInt($(this).css("padding-left"),10)+parseInt($(this).css("padding-right"),10);$(this).css("width",e-t-n)})},$("form.formtastic li.string input, form.formtastic textarea").stretchFormtasticInputWidthToParent(),$("ul.downplayed li div.content p").vAlign(),$("form.sandbox").submit(function(){var e=!0;return $(this).find("input.required").each(function(){$(this).removeClass("error"),""===$(this).val()&&($(this).addClass("error"),$(this).wiggle(),e=!1)}),e})}),Function.prototype.bind&&console&&"object"==typeof console.log&&["log","info","warn","error","assert","dir","clear","profile","profileEnd"].forEach(function(e){console[e]=this.bind(console[e],console)},Function.prototype.call),window.Docs={shebang:function(){var e=$.param.fragment().split("/");switch(e.shift(),e.length){case 1:if(e[0].length>0){var t="resource_"+e[0];Docs.expandEndpointListForResource(e[0]),$("#"+t).slideto({highlight:!1})}break;case 2:Docs.expandEndpointListForResource(e[0]),$("#"+t).slideto({highlight:!1});var n=e.join("_"),r=n+"_content";Docs.expandOperation($("#"+r)),$("#"+n).slideto({highlight:!1})}},toggleEndpointListForResource:function(e){var t=$("li#resource_"+Docs.escapeResourceName(e)+" ul.endpoints");t.is(":visible")?($.bbq.pushState("#/",2),Docs.collapseEndpointListForResource(e)):($.bbq.pushState("#/"+e,2),Docs.expandEndpointListForResource(e))},expandEndpointListForResource:function(e){var e=Docs.escapeResourceName(e);if(""==e)return void $(".resource ul.endpoints").slideDown();$("li#resource_"+e).addClass("active");var t=$("li#resource_"+e+" ul.endpoints");t.slideDown()},collapseEndpointListForResource:function(e){var e=Docs.escapeResourceName(e);if(""==e)return void $(".resource ul.endpoints").slideUp();$("li#resource_"+e).removeClass("active");var t=$("li#resource_"+e+" ul.endpoints");t.slideUp()},expandOperationsForResource:function(e){return Docs.expandEndpointListForResource(e),""==e?void $(".resource ul.endpoints li.operation div.content").slideDown():void $("li#resource_"+Docs.escapeResourceName(e)+" li.operation div.content").each(function(){Docs.expandOperation($(this))})},collapseOperationsForResource:function(e){return Docs.expandEndpointListForResource(e),""==e?void $(".resource ul.endpoints li.operation div.content").slideUp():void $("li#resource_"+Docs.escapeResourceName(e)+" li.operation div.content").each(function(){Docs.collapseOperation($(this))})},escapeResourceName:function(e){return e.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g,"\\$&")},expandOperation:function(e){e.slideDown()},collapseOperation:function(e){e.slideUp()}},Handlebars.registerHelper("sanitize",function(e){return e=e.replace(/