[java-idp-plugin-webauthn] branch main updated: Fix test and minor code cleanup

Phil Smart philip.smart at jisc.ac.uk
Tue Sep 17 08:56:19 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=bbda1c3f2c3ab4dcaaf43a3f69eec243845545eb

The following commit(s) were added to refs/heads/main by this push:
     new bbda1c3  Fix test and minor code cleanup
bbda1c3 is described below

commit bbda1c3f2c3ab4dcaaf43a3f69eec243845545eb
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Tue Sep 17 09:56:16 2024 +0100

    Fix test and minor code cleanup
---
 .../shibboleth/idp/plugin/authn/webauthn/impl/WebAuthnEncoder.java    | 4 ++--
 .../webauthn/storage/impl/IdPStorageServiceCredentialRespository.java | 2 +-
 .../idp/plugin/authn/webauthn/flow/AbstractWebAuthnFlowTest.java      | 2 +-
 .../webauthn/metadata/FidoMetadataServiceResolverFactoryTest.java     | 3 +--
 4 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/WebAuthnEncoder.java b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/WebAuthnEncoder.java
index 3b89e7e..79f165d 100644
--- a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/WebAuthnEncoder.java
+++ b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/WebAuthnEncoder.java
@@ -99,7 +99,7 @@ public final class WebAuthnEncoder {
      */
     @Nonnull @NotEmpty public static String formatInstant(@Nullable final Instant time) {
         if (time == null) {
-            return "unknown";
+            return "";
         }
         try {
             final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'hh:mm")
@@ -108,7 +108,7 @@ public final class WebAuthnEncoder {
             assert isoFormat != null;
             return isoFormat; 
         } catch (final Exception e) {
-            return "unknown";
+            return "";
         }
     }
     
diff --git a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/storage/impl/IdPStorageServiceCredentialRespository.java b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/storage/impl/IdPStorageServiceCredentialRespository.java
index e8952ce..41ab9c5 100644
--- a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/storage/impl/IdPStorageServiceCredentialRespository.java
+++ b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/storage/impl/IdPStorageServiceCredentialRespository.java
@@ -292,7 +292,7 @@ public class IdPStorageServiceCredentialRespository extends AbstractIdentifiable
 
     /** {@inheritDoc} */
     @Override
-    public Optional<CredentialRegistration> getRegistrationByUsernameAndCredentialId(
+    @Nonnull public Optional<CredentialRegistration> getRegistrationByUsernameAndCredentialId(
             final String username, final ByteArray id) {
         checkComponentActive();
         final Lock readLock = lock.readLock();
diff --git a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/flow/AbstractWebAuthnFlowTest.java b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/flow/AbstractWebAuthnFlowTest.java
index 1e2ce59..547a6f8 100644
--- a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/flow/AbstractWebAuthnFlowTest.java
+++ b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/flow/AbstractWebAuthnFlowTest.java
@@ -98,7 +98,7 @@ import net.shibboleth.shared.servlet.impl.HttpServletRequestResponseContext;
 /**
  * Abstract unit test class for WebAuthn flows.
  */
-public class AbstractWebAuthnFlowTest extends AbstractFlowTest {
+public abstract class AbstractWebAuthnFlowTest extends AbstractFlowTest {
     
     protected final static String ORIGIN = "https://idp.example.com";
     
diff --git a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/metadata/FidoMetadataServiceResolverFactoryTest.java b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/metadata/FidoMetadataServiceResolverFactoryTest.java
index 0371646..043c265 100644
--- a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/metadata/FidoMetadataServiceResolverFactoryTest.java
+++ b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/metadata/FidoMetadataServiceResolverFactoryTest.java
@@ -22,7 +22,6 @@ import java.nio.charset.StandardCharsets;
 
 import org.springframework.beans.FatalBeanException;
 import org.springframework.core.io.ClassPathResource;
-import org.springframework.core.io.FileSystemResource;
 import org.springframework.core.io.UrlResource;
 import org.springframework.util.FileCopyUtils;
 import org.testng.annotations.BeforeMethod;
@@ -54,7 +53,7 @@ public class FidoMetadataServiceResolverFactoryTest extends AbstractWebAuthnTest
         System.setProperty("com.sun.security.enableCRLDP", "true");
         
         factory = new FidoMetadataServiceFactory();
-        factory.setCacheFile(ResourceHelper.of(new FileSystemResource("cache-file.bin")));        
+        factory.setCacheFile("cache-file.bin");        
         factory.setTrustRootFile(ResourceHelper.of(new ClassPathResource("root-r3.crt")));
         factory.setExpectedLegalHeaders(new String[]{"headers"});
         factory.setId("Test metadata factory");

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


More information about the commits mailing list