spring-projects / spring-projects/spring-security

Duplication Checking Inconsistencies in ClientRegistrationRepository & UserDetailsService

Open
#7,348 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

in: core
Dominant language
Java
Stars
9.6k
Forks
6.3k
Avg merge
2d 11h
Merged PRs (30d)
52

Description

While clearly different APIs ClientRegistrationRepository and UserDetailsService have similar natures in that they take in a likely unique identifier and lookup a record by that identifier.

ClientRegistrationRepository takes a registration id and returns a ClientRegistration
UserDetailsService takes a username and returns a UserDetails

InMemoryClientRegistrationRepository as well as InMemoryReactiveClientRegistrationRepository both check for duplicates when a list of client registrations is supplied. This is sensible since registration id is semantically a primary key - to have duplicates would be an error.

MapReactiveUserDetailsService and InMemoryUserDetailsManager do not check for duplicates though.

This is inconsistent as username is just as unique as a registration id.

This may be tricky to resolve since InMemoryUserDetailsManager is quite old and it's obvious that there may be applications that rely on the duplicate users being silently resolved through overriding.

Still, this states it for the record so that we can come back to it as opportunities come to light.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Compare InMemoryClientRegistrationRepository, InMemoryReactiveClientRegistrationRepository, MapReactiveUserDetailsService, and InMemoryUserDetailsManager to document their duplicate-handling behavior. Before changing anything, establish the compatibility expectations for existing applications; done would require an agreed policy and corresponding test coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
authentication, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.