[java-idp-plugin-webauthn] branch main updated: Improve log message

Phil Smart philip.smart at jisc.ac.uk
Fri Aug 9 15:04:45 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=b497f3adcd5fa8643350a24690f0c2366a94e9f2

The following commit(s) were added to refs/heads/main by this push:
     new b497f3a  Improve log message
b497f3a is described below

commit b497f3adcd5fa8643350a24690f0c2366a94e9f2
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Fri Aug 9 16:04:43 2024 +0100

    Improve log message
---
 .../webauthn/admin/impl/DeletePublicKeyCredential.java   | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/DeletePublicKeyCredential.java b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/DeletePublicKeyCredential.java
index fd4a857..15487af 100644
--- a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/DeletePublicKeyCredential.java
+++ b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/DeletePublicKeyCredential.java
@@ -20,6 +20,7 @@ package net.shibboleth.idp.plugin.authn.webauthn.admin.impl;
 import java.util.Optional;
 
 import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
 
 import org.opensaml.messaging.context.navigate.ChildContextLookup;
 import org.opensaml.profile.action.ActionSupport;
@@ -34,6 +35,8 @@ import net.shibboleth.idp.plugin.authn.webauthn.context.WebAuthnRegistrationCont
 import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRegistration;
 import net.shibboleth.idp.plugin.authn.webauthn.storage.WebAuthnCredentialRepository;
 import net.shibboleth.shared.annotation.constraint.NonnullAfterInit;
+import net.shibboleth.shared.codec.Base64Support;
+import net.shibboleth.shared.codec.EncodingException;
 import net.shibboleth.shared.component.ComponentInitializationException;
 import net.shibboleth.shared.primitive.LoggerFactory;
 
@@ -95,7 +98,10 @@ public class DeletePublicKeyCredential extends AbstractWebAuthnAuditingAction<We
         
         if (credential.isEmpty()) {
             // This is not an error
-            log.debug("{} Unable to find credential to remove, nothing to remove", getLogPrefix());            
+            if (log.isDebugEnabled()) {
+                log.debug("{} Unable to find credential '{}' to remove for user '{}', nothing to "
+                        + "remove", getLogPrefix(),  getCredentialIdBase64OrNull(credentialId), username);    
+            }
         } else {
             final boolean removed = repository.removeRegistrationByUsername(username, credential.get());
             log.debug("{} Credential '{}' {} removed", getLogPrefix(), credential.get().getCredentialIdBase64Url(),
@@ -110,4 +116,12 @@ public class DeletePublicKeyCredential extends AbstractWebAuthnAuditingAction<We
         // Remove the key to be deleted in-case the context state is re-used
         context.setCredentialIdToRemove(null);
     }
+    
+    @Nullable private String getCredentialIdBase64OrNull(final byte[] credentialId) {
+        try {
+            return Base64Support.encodeURLSafe(credentialId);
+        } catch (final EncodingException e) {
+            return null;
+        }
+    }
 }

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


More information about the commits mailing list