This is an automated email from the ASF dual-hosted git repository.

ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git


The following commit(s) were added to refs/heads/master by this push:
     new 2a427d5a90 ISIS-3291: swagger-ui: enable auth and syntax highlighting
2a427d5a90 is described below

commit 2a427d5a90c4ab7752bdf781b675c2e199b1fa2d
Author: Andi Huber <[email protected]>
AuthorDate: Tue Nov 22 16:57:21 2022 +0100

    ISIS-3291: swagger-ui: enable auth and syntax highlighting
---
 .../src/main/resources/swagger-ui/index.thtml      | 29 ++++++++++++++++------
 1 file changed, 21 insertions(+), 8 deletions(-)

diff --git 
a/viewers/restfulobjects/viewer/src/main/resources/swagger-ui/index.thtml 
b/viewers/restfulobjects/viewer/src/main/resources/swagger-ui/index.thtml
index 669c0d44c6..57cfa27363 100644
--- a/viewers/restfulobjects/viewer/src/main/resources/swagger-ui/index.thtml
+++ b/viewers/restfulobjects/viewer/src/main/resources/swagger-ui/index.thtml
@@ -41,8 +41,9 @@
     <script src="./swagger-initializer.js" charset="UTF-8"> </script>
     <script>
     window.onload = function() {
-      // Begin Swagger UI call region
+      /* Begin Swagger UI call region */
       const ui = SwaggerUIBundle({
+       dom_id: '#swagger-ui',
        urls: [{
                url: "${restful-base}/swagger/public", name: "public"
        },{
@@ -50,8 +51,6 @@
        },{
                url: "${restful-base}/swagger/private", name: "private"
        }],
-        dom_id: '#swagger-ui',
-        deepLinking: true,
         presets: [
           SwaggerUIBundle.presets.apis,
           SwaggerUIStandalonePreset
@@ -59,11 +58,25 @@
         plugins: [
           SwaggerUIBundle.plugins.DownloadUrl
         ],
-        layout: "StandaloneLayout"
-      })
-      // End Swagger UI call region
-
-      window.ui = ui
+        layout: "StandaloneLayout",
+        deepLinking: true,
+        filter: true,
+        syntaxHighlight: {
+           activate: true,
+           theme: "nord"
+        },
+        withCredentials: true,
+        onComplete: function() {
+               console.log("pre-auth");
+               ui.preauthorizeBasic("basicAuth", "sven", "pass");
+       }
+      });
+      /* End Swagger UI call region */
+      window.ui = ui;
+      
+      console.log("pre-auth2");
+      ui.preauthorizeBasic("basicAuth", "sven", "pass");
+      
     }
   </script>
   </body>

Reply via email to