Implement equals and hashCode closes gh-18882
Signed-off-by: Andreas Asplund <andreas@asplund.biz>
This commit is contained in:
committed by
Josh Cummings
parent
1db0d4f83d
commit
330c565178
+17
@@ -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 final class ImmutablePublicKeyCredentialUserEntity implements PublicKeyCr
|
||||
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}.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user