Bump up swagger ui from 2.1.4 to 2.1.5
This commit bumps up swagger ui to 2.1.5 which fixes various bugs
of swagger ui 2.1.4.
Change-Id: I4f8d7f79b88cddada0148a8629e7ef4da9eac3a0
diff --git a/web/api/src/main/resources/docs/lib/swagger-oauth.js b/web/api/src/main/resources/docs/lib/swagger-oauth.js
old mode 100644
new mode 100755
index 576fcd3..a35bda3
--- a/web/api/src/main/resources/docs/lib/swagger-oauth.js
+++ b/web/api/src/main/resources/docs/lib/swagger-oauth.js
@@ -250,11 +250,19 @@
window.processOAuthCode = function processOAuthCode(data) {
var OAuthSchemeKey = data.state;
+
+ // redirect_uri is required in auth code flow
+ // see https://tools.ietf.org/html/draft-ietf-oauth-v2-31#section-4.1.3
+ var host = window.location;
+ var pathname = location.pathname.substring(0, location.pathname.lastIndexOf("/"));
+ var defaultRedirectUrl = host.protocol + '//' + host.host + pathname + '/o2c.html';
+ var redirectUrl = window.oAuthRedirectUrl || defaultRedirectUrl;
+
var params = {
'client_id': clientId,
'code': data.code,
'grant_type': 'authorization_code',
- 'redirect_uri': redirect_uri
+ 'redirect_uri': redirectUrl
};
if (clientSecret) {
@@ -331,7 +339,8 @@
}
}
});
- window.swaggerUi.api.clientAuthorizations.add(OAuthSchemeKey, new SwaggerClient.ApiKeyAuthorization('Authorization', 'Bearer ' + b, 'header'));
+ window.swaggerUi.api.clientAuthorizations.add(window.OAuthSchemeKey, new SwaggerClient.ApiKeyAuthorization('Authorization', 'Bearer ' + b, 'header'));
+ window.swaggerUi.load();
}
}
}