From 128fc5c112c7c364d0e8e52533cf2c2e2895b058 Mon Sep 17 00:00:00 2001 From: Robert Brownstein Date: Fri, 19 Jun 2015 13:37:54 -0400 Subject: [PATCH] Found a bug in OperationView.js which caused the oAuth toggle to be displayed for non-oAuth endpoints if oAuth was enabled at all, fixed it --- src/main/javascript/view/OperationView.js | 29 ++++++++++++----------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/main/javascript/view/OperationView.js b/src/main/javascript/view/OperationView.js index d58e87e8..d4f940d9 100644 --- a/src/main/javascript/view/OperationView.js +++ b/src/main/javascript/view/OperationView.js @@ -95,22 +95,23 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({ for (l = 0, len = modelAuths.length; l < len; l++) { auths = modelAuths[l]; for (key in auths) { - auth = auths[key]; for (a in this.auths) { auth = this.auths[a]; - if (auth.type === 'oauth2') { - this.model.oauth = {}; - this.model.oauth.scopes = []; - ref1 = auth.value.scopes; - for (k in ref1) { - v = ref1[k]; - scopeIndex = auths[key].indexOf(k); - if (scopeIndex >= 0) { - o = { - scope: k, - description: v - }; - this.model.oauth.scopes.push(o); + if (key === auth.name) { + if (auth.type === 'oauth2') { + this.model.oauth = {}; + this.model.oauth.scopes = []; + ref1 = auth.value.scopes; + for (k in ref1) { + v = ref1[k]; + scopeIndex = auths[key].indexOf(k); + if (scopeIndex >= 0) { + o = { + scope: k, + description: v + }; + this.model.oauth.scopes.push(o); + } } } }