Skip to content

Implement equals and hashCode in OidcIdToken #17485

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

therepanic
Copy link
Contributor

Closes: #15156

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jul 4, 2025
@@ -73,6 +73,23 @@ public Map<String, Object> getClaims() {
return this.claims;
}

@Override
public boolean equals(Object obj) {
if (this == obj) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think pattern matching can be applied here

if (obj instanceof OidcIdToken that) {
	return this.claims.equals(that.claims);
}

return false;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there's any point in that. You can implement the method in different ways, but make it perform the same task. I copied and polished these methods from a neighboring class, so I don't think anything needs to be changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Should OidcIdToken implement equals?
3 participants