From d386583ed1e200ac69f46ea87756b80fcc0ed057 Mon Sep 17 00:00:00 2001 From: Emil Lundberg Date: Tue, 17 Oct 2023 20:59:27 +0200 Subject: [PATCH] Clarify that CredentialRepository implementations MUST NOT return null --- .../java/com/yubico/webauthn/CredentialRepository.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/webauthn-server-core/src/main/java/com/yubico/webauthn/CredentialRepository.java b/webauthn-server-core/src/main/java/com/yubico/webauthn/CredentialRepository.java index 990ba08c2..9fa2871bb 100644 --- a/webauthn-server-core/src/main/java/com/yubico/webauthn/CredentialRepository.java +++ b/webauthn-server-core/src/main/java/com/yubico/webauthn/CredentialRepository.java @@ -42,6 +42,8 @@ public interface CredentialRepository { * *

After a successful registration ceremony, the {@link RegistrationResult#getKeyId()} method * returns a value suitable for inclusion in this set. + * + *

Implementations of this method MUST NOT return null. */ Set getCredentialIdsForUsername(String username); @@ -51,6 +53,8 @@ public interface CredentialRepository { * *

Used to look up the user handle based on the username, for authentication ceremonies where * the username is already given. + * + *

Implementations of this method MUST NOT return null. */ Optional getUserHandleForUsername(String username); @@ -60,6 +64,8 @@ public interface CredentialRepository { * *

Used to look up the username based on the user handle, for username-less authentication * ceremonies. + * + *

Implementations of this method MUST NOT return null. */ Optional getUsernameForUserHandle(ByteArray userHandle); @@ -69,6 +75,8 @@ public interface CredentialRepository { * *

The returned {@link RegisteredCredential} is not expected to be long-lived. It may be read * directly from a database or assembled from other components. + * + *

Implementations of this method MUST NOT return null. */ Optional lookup(ByteArray credentialId, ByteArray userHandle); @@ -79,6 +87,8 @@ public interface CredentialRepository { *

This is used to refuse registration of duplicate credential IDs. Therefore, under normal * circumstances this method should only return zero or one credential (this is an expected * consequence, not an interface requirement). + * + *

Implementations of this method MUST NOT return null. */ Set lookupAll(ByteArray credentialId); }