[java-idp-plugin-webauthn] branch main updated: Add back accidently remove support JS and clean views

Phil Smart philip.smart at jisc.ac.uk
Mon Jan 22 16:38:59 UTC 2024


This is an automated email from the git hooks/post-receive script.

philsmart pushed a commit to branch main
in repository java-idp-plugin-webauthn.

View the commit online:
http://git.shibboleth.net/view/?p=java-idp-plugin-webauthn.git;a=commit;h=e17f7162e734558a932aaf3274e37b55e1a7f9b6

The following commit(s) were added to refs/heads/main by this push:
     new e17f716  Add back accidently remove support JS and clean views
e17f716 is described below

commit e17f7162e734558a932aaf3274e37b55e1a7f9b6
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Mon Jan 22 16:38:56 2024 +0000

    Add back accidently remove support JS and clean views
---
 .../idp/plugin/authn/webauthn/js/webauthn-support.js     | 16 ++++++++++++++++
 .../idp/plugin/authn/webauthn/views/webauthn-authn.vm    |  4 ++--
 .../idp/plugin/authn/webauthn/views/webauthn-register.vm |  6 +++---
 .../idp/plugin/authn/webauthn/views/webauthn-selector.vm |  2 +-
 .../authn/webauthn/views/webauthn-username-entry.vm      |  7 ++++---
 5 files changed, 26 insertions(+), 9 deletions(-)

diff --git a/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/js/webauthn-support.js b/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/js/webauthn-support.js
new file mode 100644
index 0000000..7868e8c
--- /dev/null
+++ b/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/js/webauthn-support.js
@@ -0,0 +1,16 @@
+document.addEventListener('DOMContentLoaded', function() {
+   var coll = document.getElementsByClassName("collapsible");
+    var i;
+
+    for (i = 0; i < coll.length; i++) {
+        coll[i].addEventListener("click", function() {
+            this.classList.toggle("active");
+            var content = this.nextElementSibling;
+            if (content.style.display === "block") {
+                content.style.display = "none";
+            } else {
+                content.style.display = "block";
+            }
+        });
+    }
+});
\ No newline at end of file
diff --git a/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/views/webauthn-authn.vm b/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/views/webauthn-authn.vm
index 1bc1b02..77e2c5c 100644
--- a/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/views/webauthn-authn.vm
+++ b/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/views/webauthn-authn.vm
@@ -28,7 +28,7 @@
     <meta charset="UTF-8" />
     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
     <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0">
-    <script type="text/javascript" src="$request.getContextPath()/js/webauthn-support.js"></script>
+    <script type="text/javascript" src="$request.getContextPath()/js/webauthn/webauthn-support.js"></script>
     <link rel="stylesheet" type="text/css" href="$request.getContextPath()#springMessageText("
         idp.css", "/css/placeholder.css" )">
     <link rel="stylesheet" type="text/css" href="$request.getContextPath()/css/webauthn.css">
@@ -147,7 +147,7 @@
                                 "Request Options")</label>
                             <textarea id="publicKeyCredentialRequestOptions" name="publicKeyCredentialRequestOptions"
                                 rows="20" cols="50">
-                                $webauthnContext.publicKeyCredentialRequestOptions</textarea>
+                                $webauthnContext.publicKeyCredentialRequestOptionsJSON</textarea>
                         </div>
                         #end
                     </div>
diff --git a/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/views/webauthn-register.vm b/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/views/webauthn-register.vm
index a29d4a1..34401a2 100644
--- a/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/views/webauthn-register.vm
+++ b/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/views/webauthn-register.vm
@@ -28,7 +28,7 @@
   <meta charset="UTF-8" />
   <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
   <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0">
-  <script type="text/javascript" src="$request.getContextPath()/js/webauthn-support.js"></script>
+  <script type="text/javascript" src="$request.getContextPath()/js/webauthn/webauthn-support.js"></script>
   <link rel="stylesheet" type="text/css" href="$request.getContextPath()#springMessageText("idp.css", "/css/placeholder.css" )">
   <link rel="stylesheet" type="text/css" href="$request.getContextPath()/css/webauthn.css">
   <script type="module">
@@ -134,7 +134,7 @@
                      #end
                      <br/>
                      <div>
-                        <button class="form-element form-button" id="registerButton">#springMessageText("idp.webauthn.register.addKey", "Add Key")</button>
+                        <button class="form-element form-button" id="registerButton">#springMessageText("idp.webauthn.register.addKey", "Add New Security Key")</button>
                      </div>
                      
                       <form id="authenticatorAttestationForm" action="$flowExecutionUrl" method="post">
@@ -153,7 +153,7 @@
                     <div class="debug" id="debug-div">
                         <label for="publicKeyCredentialCreation">#springMessageText("idp.webauthn.register.debug.registration", "Registration Options")</label>
                         <textarea id="publicKeyCredentialCreation" name="publicKeyCredentialCreation" rows="20" cols="50">
-                        $webauthnRegContext.publicKeyCredentialCreationOptions</textarea>                   
+                        $webauthnRegContext.publicKeyCredentialCreationOptionsJSON</textarea>                   
                     </div>
                 #end
         
diff --git a/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/views/webauthn-selector.vm b/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/views/webauthn-selector.vm
index 1a2784d..96dde0e 100644
--- a/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/views/webauthn-selector.vm
+++ b/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/views/webauthn-selector.vm
@@ -40,7 +40,7 @@
                     #parse("csrf/csrf.vm")
                     <div class="grid">
                             <div class="grid-item">
-                                <button type="submit" name="_eventId_proceed">Use Key</button>
+                                <button type="submit" name="_eventId_proceed">Use Security Key</button>
                             </div>
                     </div>
                  </form>
diff --git a/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/views/webauthn-username-entry.vm b/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/views/webauthn-username-entry.vm
index 68e9260..3186abe 100644
--- a/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/views/webauthn-username-entry.vm
+++ b/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/views/webauthn-username-entry.vm
@@ -25,7 +25,8 @@
 #set ($nonce = $cspNonce.generateIdentifier())
 $response.addHeader("Content-Security-Policy", "script-src-elem 'nonce-$nonce'")
 #set ($onClick = "document.forms.password.j_username.value = document.forms.passwordless.j_username.value")
-$response.addHeader("Content-Security-Policy", "script-src-attr 'unsafe-hashes' 'sha256-$cspDigester.apply($onClick)'")
+### TODO ADD THIS BACK
+###$response.addHeader("Content-Security-Policy", "script-src-attr 'unsafe-hashes' 'sha256-$cspDigester.apply($onClick)'")
 ##
 <!DOCTYPE html>
 <html>
@@ -81,7 +82,7 @@ $response.addHeader("Content-Security-Policy", "script-src-attr 'unsafe-hashes'
                     #parse("csrf/csrf.vm")
                     
                     <label for="username">#springMessageText("idp.login.username", "Username")</label>
-                    <input id="j_username" name="j_username" type="text"
+                    <input id="j_username" name="j_username" type="text" autoComplete="username webauthn"
                         value="#if($username)$encoder.encodeForHTML($username)#end" />
                         
                     <input type="checkbox" name="donotcache" value="1" id="donotcache" />
@@ -99,7 +100,7 @@ $response.addHeader("Content-Security-Policy", "script-src-attr 'unsafe-hashes'
                 </form>
     
                 <ul>
-                    <li><a href="#springMessageText('idp.duo.enrollment.url', 'idp/profile/admin/webauthn-registration')">#springMessageText("idp.duo.enrollment", "Enroll New Devices")</a></li>
+                    <li><a href="#springMessageText('idp.duo.enrollment.url', '/idp/profile/admin/webauthn-registration')">#springMessageText("idp.duo.enrollment", "Enroll New Devices")</a></li>
                     <li><a href="#springMessageText('idp.url.helpdesk', '#')">#springMessageText("idp.login.needHelp", "Need Help?")</a></li>
                 </ul>
             </section>

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list