[java-idp-plugin-webauthn] 02/02: Add annontations and fix threading test
Phil Smart
philip.smart at jisc.ac.uk
Wed Apr 9 15:22:56 UTC 2025
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=9328e052d9d0baf1c4fa782120fdd6dae8fe3448
commit 9328e052d9d0baf1c4fa782120fdd6dae8fe3448
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Wed Apr 9 09:27:11 2025 +0100
Add annontations and fix threading test
- the threading test had a possible NPE depending on the order each
thread ran (this is a problem with the test, not the repository
implementation)
---
.../idp/plugin/authn/webauthn/storage/CredentialRecord.java | 6 +++---
.../storage/impl/IdPStorageServiceCredentialRespositoryTest.java | 7 +++++--
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/webauthn-api/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/storage/CredentialRecord.java b/webauthn-api/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/storage/CredentialRecord.java
index b89d079..6451019 100644
--- a/webauthn-api/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/storage/CredentialRecord.java
+++ b/webauthn-api/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/storage/CredentialRecord.java
@@ -215,7 +215,7 @@ public final class CredentialRecord {
* @since 1.1.0
*/
@JsonGetter("lastUsedTime")
- public Instant getLastUsedTime() {
+ @Nullable public Instant getLastUsedTime() {
return lastUsedTime;
}
@@ -235,7 +235,7 @@ public final class CredentialRecord {
* @return the credential ID base64URL encoded
*/
@JsonIgnore
- public String getCredentialIdBase64() {
+ @Nullable public String getCredentialIdBase64() {
return credential.getCredentialId().getBase64();
}
@@ -245,7 +245,7 @@ public final class CredentialRecord {
* @return the credential ID Hex encoded
*/
@JsonIgnore
- public String getCredentialIdHex() {
+ @Nullable public String getCredentialIdHex() {
return credential.getCredentialId().getHex();
}
diff --git a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/storage/impl/IdPStorageServiceCredentialRespositoryTest.java b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/storage/impl/IdPStorageServiceCredentialRespositoryTest.java
index 90549bc..684c176 100644
--- a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/storage/impl/IdPStorageServiceCredentialRespositoryTest.java
+++ b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/storage/impl/IdPStorageServiceCredentialRespositoryTest.java
@@ -823,8 +823,11 @@ public class IdPStorageServiceCredentialRespositoryTest extends AbstractWebAuthn
// Important, this should not be able to read a state where the update has just removed the old credential
// But not yet added back to the updated credential
if (cred.isEmpty()) return false;
- // Accept this read either happens before the update or after.
- return cred.get().getLastUsedTime().equals(now);
+ // Accept this read either happens before the update or after.
+ final var lastUsedTime = cred.get().getLastUsedTime();
+ // If null, it happens before, and that is not a failure
+ if (lastUsedTime == null) return true;
+ return lastUsedTime.equals(now);
}));
for (final Future<Boolean> f : futures) {
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list