diff --git a/dist/lib/swagger-oauth.js b/dist/lib/swagger-oauth.js
index c4e144fa..4cfefe65 100644
--- a/dist/lib/swagger-oauth.js
+++ b/dist/lib/swagger-oauth.js
@@ -140,6 +140,9 @@ function handleLogin() {
scopes.push(scope);
}
+ // Implicit auth recommends a state parameter.
+ var state = Math.random ();
+
window.enabledScopes=scopes;
redirect_uri = redirectUrl;
@@ -148,6 +151,7 @@ function handleLogin() {
url += '&realm=' + encodeURIComponent(realm);
url += '&client_id=' + encodeURIComponent(clientId);
url += '&scope=' + encodeURIComponent(scopes);
+ url += '&state=' + encodeURIComponent(state);
window.open(url);
});
diff --git a/dist/swagger-ui.js b/dist/swagger-ui.js
index 3e5fa7a6..ba20d20c 100644
--- a/dist/swagger-ui.js
+++ b/dist/swagger-ui.js
@@ -401,6 +401,27 @@ Handlebars.registerHelper('sanitize', function(html) {
this["Handlebars"]["templates"]["basic_auth_button_view"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
return "
"
+ escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.title : stack1), depth0))
@@ -613,32 +558,58 @@ this["Handlebars"]["templates"]["main"] = Handlebars.template({"1":function(dept
if (stack1 != null) { buffer += stack1; }
return buffer + " \n
\n\n";
},"useData":true});
-var ContentTypeView,
+var BasicAuthButton,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
__hasProp = {}.hasOwnProperty;
-ContentTypeView = (function(_super) {
- __extends(ContentTypeView, _super);
+BasicAuthButton = (function(_super) {
+ __extends(BasicAuthButton, _super);
- function ContentTypeView() {
- return ContentTypeView.__super__.constructor.apply(this, arguments);
+ function BasicAuthButton() {
+ return BasicAuthButton.__super__.constructor.apply(this, arguments);
}
- ContentTypeView.prototype.initialize = function() {};
+ BasicAuthButton.prototype.initialize = function() {};
- ContentTypeView.prototype.render = function() {
+ BasicAuthButton.prototype.render = function() {
var template;
template = this.template();
$(this.el).html(template(this.model));
- $('label[for=contentType]', $(this.el)).text('Response Content Type');
return this;
};
- ContentTypeView.prototype.template = function() {
- return Handlebars.templates.content_type;
+ BasicAuthButton.prototype.events = {
+ "click #basic_auth_button": "togglePasswordContainer",
+ "click #apply_basic_auth": "applyPassword"
};
- return ContentTypeView;
+ BasicAuthButton.prototype.applyPassword = function() {
+ var elem, password, username;
+ username = $(".input_username").val();
+ password = $(".input_password").val();
+ window.authorizations.add(this.model.type, new PasswordAuthorization("basic", username, password));
+ window.swaggerUi.load();
+ return elem = $('#basic_auth_container').hide();
+ };
+
+ BasicAuthButton.prototype.togglePasswordContainer = function() {
+ var elem;
+ if ($('#basic_auth_container').length > 0) {
+ elem = $('#basic_auth_container').show();
+ if (elem.is(':visible')) {
+ return elem.slideUp();
+ } else {
+ $('.auth_container').hide();
+ return elem.show();
+ }
+ }
+ };
+
+ BasicAuthButton.prototype.template = function() {
+ return Handlebars.templates.basic_auth_button_view;
+ };
+
+ return BasicAuthButton;
})(Backbone.View);
@@ -745,68 +716,32 @@ this["Handlebars"]["templates"]["operation"] = Handlebars.template({"1":function
if (stack1 != null) { buffer += stack1; }
return buffer + " \n