updated oauth2 support into a single config
This commit is contained in:
18
dist/index.html
vendored
18
dist/index.html
vendored
@@ -17,6 +17,7 @@
|
|||||||
<script src='swagger-ui.js' type='text/javascript'></script>
|
<script src='swagger-ui.js' type='text/javascript'></script>
|
||||||
<script src='lib/highlight.7.3.pack.js' type='text/javascript'></script>
|
<script src='lib/highlight.7.3.pack.js' type='text/javascript'></script>
|
||||||
|
|
||||||
|
<!-- enabling this will enable oauth2 implicit scope support -->
|
||||||
<script src='lib/swagger-oauth.js' type='text/javascript'></script>
|
<script src='lib/swagger-oauth.js' type='text/javascript'></script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
@@ -28,12 +29,18 @@
|
|||||||
onComplete: function(swaggerApi, swaggerUi){
|
onComplete: function(swaggerApi, swaggerUi){
|
||||||
log("Loaded SwaggerUI");
|
log("Loaded SwaggerUI");
|
||||||
|
|
||||||
if(typeof initOAuth == "function")
|
if(typeof initOAuth == "function") {
|
||||||
|
/*
|
||||||
initOAuth({
|
initOAuth({
|
||||||
clientId: "me",
|
clientId: "your-client-id",
|
||||||
realm: "realms"
|
realm: "your-realms",
|
||||||
|
appName: "your-app-name"
|
||||||
|
});
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
$('pre code').each(function(i, e) {
|
||||||
|
hljs.highlightBlock(e)
|
||||||
});
|
});
|
||||||
$('pre code').each(function(i, e) {hljs.highlightBlock(e)});
|
|
||||||
},
|
},
|
||||||
onFailure: function(data) {
|
onFailure: function(data) {
|
||||||
log("Unable to Load SwaggerUI");
|
log("Unable to Load SwaggerUI");
|
||||||
@@ -51,7 +58,6 @@
|
|||||||
})
|
})
|
||||||
window.swaggerUi.load();
|
window.swaggerUi.load();
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
@@ -59,7 +65,6 @@
|
|||||||
<div id='header'>
|
<div id='header'>
|
||||||
<div class="swagger-ui-wrap">
|
<div class="swagger-ui-wrap">
|
||||||
<a id="logo" href="http://swagger.wordnik.com">swagger</a>
|
<a id="logo" href="http://swagger.wordnik.com">swagger</a>
|
||||||
|
|
||||||
<form id='api_selector'>
|
<form id='api_selector'>
|
||||||
<div class='input icon-btn'>
|
<div class='input icon-btn'>
|
||||||
<img id="show-pet-store-icon" src="images/pet_store_api.png" title="Show Swagger Petstore Example Apis">
|
<img id="show-pet-store-icon" src="images/pet_store_api.png" title="Show Swagger Petstore Example Apis">
|
||||||
@@ -75,7 +80,6 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="message-bar" class="swagger-ui-wrap"> </div>
|
<div id="message-bar" class="swagger-ui-wrap"> </div>
|
||||||
|
|
||||||
<div id="swagger-ui-container" class="swagger-ui-wrap"></div>
|
<div id="swagger-ui-container" class="swagger-ui-wrap"></div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
8
dist/lib/swagger-oauth.js
vendored
8
dist/lib/swagger-oauth.js
vendored
@@ -1,11 +1,12 @@
|
|||||||
function handleLogin() {
|
|
||||||
var scopes = [];
|
|
||||||
var appName;
|
var appName;
|
||||||
var popupMask;
|
var popupMask;
|
||||||
var popupDialog;
|
var popupDialog;
|
||||||
var clientId;
|
var clientId;
|
||||||
var realm;
|
var realm;
|
||||||
|
|
||||||
|
function handleLogin() {
|
||||||
|
var scopes = [];
|
||||||
|
|
||||||
if(window.swaggerUi.api.authSchemes
|
if(window.swaggerUi.api.authSchemes
|
||||||
&& window.swaggerUi.api.authSchemes.oauth2
|
&& window.swaggerUi.api.authSchemes.oauth2
|
||||||
&& window.swaggerUi.api.authSchemes.oauth2.scopes) {
|
&& window.swaggerUi.api.authSchemes.oauth2.scopes) {
|
||||||
@@ -17,7 +18,8 @@ function handleLogin() {
|
|||||||
appName = window.swaggerUi.api.info.title;
|
appName = window.swaggerUi.api.info.title;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(popupDialog.length > 0) popupDialog = popupDialog.last();
|
if(popupDialog.length > 0)
|
||||||
|
popupDialog = popupDialog.last();
|
||||||
else {
|
else {
|
||||||
popupDialog = $(
|
popupDialog = $(
|
||||||
[
|
[
|
||||||
|
|||||||
Reference in New Issue
Block a user