[java-idp-plugin-webauthn] branch main updated: Allowing enabling and disabling debug information

Phil Smart philip.smart at jisc.ac.uk
Fri Dec 15 14:42:52 UTC 2023


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=21f83a6d31a5ef1125d7b4e884b61af70504961c

The following commit(s) were added to refs/heads/main by this push:
     new 21f83a6  Allowing enabling and disabling debug information
21f83a6 is described below

commit 21f83a6d31a5ef1125d7b4e884b61af70504961c
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Fri Dec 15 14:42:50 2023 +0000

    Allowing enabling and disabling debug information
    
     - Probably not needed long term, but expose an option for it for the
    time being.
---
 .../admin/impl/StorePublicKeyCredential.java       |  2 +-
 .../authn/webauthn/conf/authn/webauthn.properties  |  5 ++-
 .../idp/plugin/authn/webauthn/css/webauthn.css     |  7 ++--
 .../plugin/authn/webauthn/views/webauthn-authn.vm  | 31 ++++++++++--------
 .../authn/webauthn/views/webauthn-register.vm      | 38 +++++++++++++---------
 .../views/webauthn-registration-outcomes.vm        |  8 +++--
 .../authn/webauthn/views/webauthn-selector.vm      |  2 +-
 7 files changed, 57 insertions(+), 36 deletions(-)

diff --git a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/StorePublicKeyCredential.java b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/StorePublicKeyCredential.java
index 418aca3..246ed51 100644
--- a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/StorePublicKeyCredential.java
+++ b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/StorePublicKeyCredential.java
@@ -138,7 +138,7 @@ public class StorePublicKeyCredential extends AbstractWebAuthnRegistrationAction
             
             
             log.debug("{} Added public key credential registration for user '{}' and key '{}'. Using a "
-                    + "discoverable credential '{}', and UserVerification '{}'", 
+                    + "discoverable credential '{}', and user verification '{}'", 
                     getLogPrefix(), username, registrationResult.getKeyId().getId().getBase64Url(),
                     registrationResult.isDiscoverable().isPresent() ? registrationResult.isDiscoverable() : "unknown", 
                             registrationResult.isUserVerified());
diff --git a/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/conf/authn/webauthn.properties b/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/conf/authn/webauthn.properties
index 302fe2d..c746019 100644
--- a/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/conf/authn/webauthn.properties
+++ b/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/conf/authn/webauthn.properties
@@ -4,4 +4,7 @@ idp.authn.webauthn.relyingPartyId = localhost
 idp.authn.webauthn.relyingPartyName = Shibboleth
 ## Allow any port on that origin
 idp.authn.webauthn.allowOriginPort = true
-idp.authn.webauthn.allowOriginSubdomain = false
\ No newline at end of file
+idp.authn.webauthn.allowOriginSubdomain = false
+
+## Display debug information about the registration and authentication ceremony on their respective views?
+#idp.authn.webauthn.ui.debug = false
\ No newline at end of file
diff --git a/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/css/webauthn.css b/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/css/webauthn.css
index b9d5cf5..683a62f 100644
--- a/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/css/webauthn.css
+++ b/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/css/webauthn.css
@@ -8,12 +8,15 @@ table {
 th,
 td {
     padding: 8px;
-    text-align: left;
     border-bottom: 1px solid #ddd;
 }
 
+th {
+    font-weight: bold;
+}
+
 tr:hover {
-    background-color: coral;
+    background-color: rgb(237, 241, 255);
 }
 
 
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 cc1ade8..b462f3b 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
@@ -17,6 +17,7 @@
 ## environment - Spring Environment object for property resolution
 ## custom - arbitrary object injected by deployer
 ##
+#set ($debug = $environment.getProperty("idp.authn.webauthn.ui.debug", "false"))
 #set ($rpContext = $profileRequestContext.getSubcontext('net.shibboleth.idp.profile.context.RelyingPartyContext'))
 ##
 <!DOCTYPE html>
@@ -48,8 +49,11 @@
           document.getElementById("authenticate").onclick = authenticate;        
           return false;
      }
-     
+  #if($debug == "true")   
      window.onload = init;
+  #else
+    window.onload = authenticate;
+  #end
 
 </script>
 </head>
@@ -69,23 +73,24 @@
 
             <div class="content">
                 <div class="column one">
-                    <div class="centre">
-                        <button id="authenticate" class="form-element form-button">Authenticate</button>
-                    </div>
                     <form id="authn-form" action="$flowExecutionUrl" method="post">
                         #parse("csrf/csrf.vm")
                         <input type="hidden" id="publicKeyAssertion" name="publicKeyAssertion"/>
                         <button class="hidden" id="authenticationSubmit" type="submit" name="_eventId_proceed">Submit Authentication</button>
                     </form>
-                    
-                    <hr/>
-                    <button type="button" class="collapsible">Debugging</button> 
-                    
-                    <div class="debug" id="debug-div">
-                      <label for="publicKeyCredentialCreation">Request Options</label>
-                      <textarea id="publicKeyCredentialRequestOptions" name="publicKeyCredentialRequestOptions" rows="20" cols="50">
-                        $webauthnContext.publicKeyCredentialRequestOptions</textarea>
-                    </div>
+                    #if($debug == "true")
+                        <div class="centre">
+                            <button id="authenticate" class="form-element form-button">Authenticate</button>
+                        </div>                                           
+                        <hr/>
+                        <button type="button" class="collapsible">Debugging</button> 
+                        
+                        <div class="debug" id="debug-div">
+                          <label for="publicKeyCredentialCreation">Request Options</label>
+                          <textarea id="publicKeyCredentialRequestOptions" name="publicKeyCredentialRequestOptions" rows="20" cols="50">
+                            $webauthnContext.publicKeyCredentialRequestOptions</textarea>
+                        </div>
+                    #end
                 </div>
 
             </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 0481101..c4f6992 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
@@ -17,6 +17,7 @@
 ## environment - Spring Environment object for property resolution
 ## custom - arbitrary object injected by deployer
 ##
+#set ($debug = $environment.getProperty("idp.authn.webauthn.ui.debug", "false"))
 #set ($rpContext = $profileRequestContext.getSubcontext('net.shibboleth.idp.profile.context.RelyingPartyContext'))
 ##
 <!DOCTYPE html>
@@ -77,12 +78,13 @@
         <div class="content">
           <div class="column one centre"> 
             <div>
-                <h1>Registered Credentials</h1>
+                <h1>Registered Keys</h1>
                  #if ($webauthnRegContext.existingCredentials)
                     <table>
                         <tr>
                             <th>Key Name</th>
                             <th>Transports</th>
+                            <th>Is Passkey</th>
                             <th>Registration Time</th>
                             <th>Action</th>
                         </tr>
@@ -90,6 +92,7 @@
                             <tr>
                                 <td>$encoder.encodeForHTML($cred.nickname)</td>
                                 <td>$encoder.encodeForHTML($cred.transportsString)</td>
+                                <td>$encoder.encodeForHTML($cred.discoverableAsString)</td>
                                 <td>$encoder.encodeForHTML($cred.registrationTimestamp)</td>
                                 <td>
                                 <form id="deleteKeyForm" action="$flowExecutionUrl" method="post">
@@ -102,29 +105,32 @@
                          #end   
                     </table>
                  #else
-                    <div><span>You have no registered credentials</span></div>                 
+                    <div><span>You have no registered keys</span></div>                 
                  #end
                  <br/>
                  <div>
                     <button class="form-element form-button" id="registerButton">Add Key</button>
                  </div>
+                 
+                  <form id="authenticatorAttestationForm" action="$flowExecutionUrl" method="post">
+                      #parse("csrf/csrf.vm")
+                      <input type="hidden" id="credentialNickname" name="credentialNickname"/>
+                      <input type="hidden" id="authenticatorAttestation" name="authenticatorAttestation"/>
+                      <button class="hidden" id="registrationSubmit" type="submit" name="_eventId_addKey">Submit Registration</button>
+                  </form>
             </div>
-            <hr/>
-           
-            <button type="button" class="collapsible">Debugging</button> 
             
-            <div class="debug" id="debug-div">
-                <label for="publicKeyCredentialCreation">Registration Options</label>
-                <textarea id="publicKeyCredentialCreation" name="publicKeyCredentialCreation" rows="20" cols="50">
-                $webauthnRegContext.publicKeyCredentialCreationOptions</textarea>
+            #if($debug == "true")
+                <hr/>
+               
+                <button type="button" class="collapsible">Debugging</button> 
                 
-                <form id="authenticatorAttestationForm" action="$flowExecutionUrl" method="post">
-                  #parse("csrf/csrf.vm")
-                  <input type="hidden" id="credentialNickname" name="credentialNickname"/>
-                  <input type="hidden" id="authenticatorAttestation" name="authenticatorAttestation"/>
-                  <button class="hidden" id="registrationSubmit" type="submit" name="_eventId_addKey">Submit Registration</button>
-                </form>
-            </div>
+                <div class="debug" id="debug-div">
+                    <label for="publicKeyCredentialCreation">Registration Options</label>
+                    <textarea id="publicKeyCredentialCreation" name="publicKeyCredentialCreation" rows="20" cols="50">
+                    $webauthnRegContext.publicKeyCredentialCreationOptions</textarea>                   
+                </div>
+            #end
     
           </div>
     
diff --git a/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/views/webauthn-registration-outcomes.vm b/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/views/webauthn-registration-outcomes.vm
index 70d9e66..cb7e06d 100644
--- a/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/views/webauthn-registration-outcomes.vm
+++ b/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/views/webauthn-registration-outcomes.vm
@@ -52,23 +52,27 @@
                 <hr />
                 
                 #if ($webauthnRegContext.existingCredentials)
-                    <p>Registered credentials</p>
+                    <p>Registered Keys</p>
                     <table>
                         <tr>
                             <th>Key Name</th>
                             <th>Transports</th>
+                            <th>Is Passkey</th>
+                            <th>User Verified On Registration</th>
                             <th>Registration Time</th>
                         </tr>
                         #foreach($cred in $webauthnRegContext.existingCredentials)
                         <tr>
                             <td>$encoder.encodeForHTML($cred.nickname)</td>
                             <td>$encoder.encodeForHTML($cred.transportsString)</td>
+                            <td>$encoder.encodeForHTML($cred.discoverableAsString)</td>
+                            <td>$encoder.encodeForHTML($cred.userVerified)</td>
                             <td>$encoder.encodeForHTML($cred.registrationTimestamp)</td>
                         </tr>
                         #end
                     </table>
                 #else
-                    <div><span>You have no registered credentials</span></div>
+                    <div><span>You have no registered keys</span></div>
                 #end
                 <br />
                 <form id="doneButtonForm" action="$flowExecutionUrl" method="post">
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 2fc47e6..a7099dc 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 Passkey</button>
+                                <button type="submit" name="_eventId_proceed">Use Key</button>
                             </div>
                     </div>
                  </form>

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


More information about the commits mailing list