Skip to content

Commit

Permalink
added equals and hashcode to MainUserDetails
Browse files Browse the repository at this point in the history
  • Loading branch information
Longwater1234 committed Dec 12, 2024
1 parent ec8ff7f commit b069c1a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.io.Serializable;
import java.util.Collection;
import java.util.Collections;
import java.util.Objects;

@Getter
public class MainUserDetails implements UserDetails, Serializable {
Expand Down Expand Up @@ -67,4 +68,16 @@ public boolean isEnabled() {
return user.getEnabled();
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
MainUserDetails that = (MainUserDetails) o;
return Objects.equals(user.getEmail(), that.user.getEmail());
}

@Override
public int hashCode() {
return Objects.hashCode(user.getEmail());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import java.util.Objects;

/**
* [NOT A TABLE]
Expand Down Expand Up @@ -67,5 +68,17 @@ public String getEmail() {
return oidcUser.getAttribute("email");
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
CustomOAuthUser that = (CustomOAuthUser) o;
return Objects.equals(oidcUser.getEmail(), that.oidcUser.getEmail());
}

@Override
public int hashCode() {
return Objects.hash(super.hashCode(), oidcUser);
}
}

0 comments on commit b069c1a

Please sign in to comment.