diff --git a/webauthn/src/main/java/org/springframework/security/web/webauthn/api/ImmutablePublicKeyCredentialUserEntity.java b/webauthn/src/main/java/org/springframework/security/web/webauthn/api/ImmutablePublicKeyCredentialUserEntity.java index 2ca0fd3a7d9..6ff20fda570 100644 --- a/webauthn/src/main/java/org/springframework/security/web/webauthn/api/ImmutablePublicKeyCredentialUserEntity.java +++ b/webauthn/src/main/java/org/springframework/security/web/webauthn/api/ImmutablePublicKeyCredentialUserEntity.java @@ -17,6 +17,7 @@ package org.springframework.security.web.webauthn.api; import java.io.Serial; +import java.util.Objects; import org.jspecify.annotations.Nullable; @@ -135,6 +136,22 @@ public static PublicKeyCredentialUserEntityBuilder builder() { return new PublicKeyCredentialUserEntityBuilder(); } + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof ImmutablePublicKeyCredentialUserEntity that)) { + return false; + } + return Objects.equals(this.name, that.name) && Objects.equals(this.id, that.id); + } + + @Override + public int hashCode() { + return Objects.hash(this.name, this.id); + } + /** * Used to build {@link PublicKeyCredentialUserEntity}. *