Skip to content

Conversation

@franticticktick
Copy link
Contributor

Closes gh-16750

Closes spring-projectsgh-16750

Signed-off-by: Max Batischev <mblancer@mail.ru>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Mar 19, 2025
Copy link
Contributor

@jzheaux jzheaux left a comment

Choose a reason for hiding this comment

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

Thanks, @franticticktick! I've left my feedback inline.

public <T extends ReactiveClientRegistrationRepository & Iterable<ClientRegistration>> SupplierReactiveClientRegistrationRepository(
Supplier<? extends ReactiveClientRegistrationRepository> repositorySupplier) {
Assert.notNull(repositorySupplier, "repositorySupplier cannot be null");
this.repositorySupplier = SingletonSupplier.of(repositorySupplier);
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you able to change this logic to reflect SupplierReactiveJwtDecoder? I'd prefer to rely on reactive operations in this class since they are available to us.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We have JwtDecoderInitializationException to indicate an error with lazy initialization of a JwtDecoder instance. Maybe it makes sense to introduce ClientRegistrationInitializationException in a separate commit?

Copy link
Member

Choose a reason for hiding this comment

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

@franticticktick The problem is that if Supplier.get() is a blocking operation (e.g. making an HTTP request), then when ReactiveClientRegistrationRepository.findByRegistrationId is invoked it will invoke Supplier.get() and block the main thread.

@franticticktick
Copy link
Contributor Author

Hey @jzheaux, maybe this PR got lost, could you look at it when you have time?

@jgrandja jgrandja added type: enhancement A general enhancement in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) and removed status: waiting-for-triage An issue we've not yet triaged labels Jun 11, 2025
@rwinch rwinch self-assigned this Jun 27, 2025
Copy link
Member

@rwinch rwinch left a comment

Choose a reason for hiding this comment

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

Thanks again for the PR @franticticktick! Please see my feedback inline

*/
@Override
public Iterator<ClientRegistration> iterator() {
return ((Iterable<ClientRegistration>) this.repositorySupplier.get()).iterator();
Copy link
Member

Choose a reason for hiding this comment

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

If the generic type is done correctly, then this should not need to be cast. I've added hints in the code how to do this

public final class SupplierReactiveClientRegistrationRepository
implements ReactiveClientRegistrationRepository, Iterable<ClientRegistration> {

private final Supplier<? extends ReactiveClientRegistrationRepository> repositorySupplier;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
private final Supplier<? extends ReactiveClientRegistrationRepository> repositorySupplier;
private final Supplier<T> repositorySupplier;

* @see ReactiveClientRegistrationRepository
* @see ClientRegistration
*/
public final class SupplierReactiveClientRegistrationRepository
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
public final class SupplierReactiveClientRegistrationRepository
public final class SupplierReactiveClientRegistrationRepository<T extends ReactiveClientRegistrationRepository & Iterable<ClientRegistration>>

Comment on lines +46 to +47
public <T extends ReactiveClientRegistrationRepository & Iterable<ClientRegistration>> SupplierReactiveClientRegistrationRepository(
Supplier<? extends ReactiveClientRegistrationRepository> repositorySupplier) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
public <T extends ReactiveClientRegistrationRepository & Iterable<ClientRegistration>> SupplierReactiveClientRegistrationRepository(
Supplier<? extends ReactiveClientRegistrationRepository> repositorySupplier) {
public SupplierReactiveClientRegistrationRepository(Supplier<T> repositorySupplier) {

@rwinch rwinch added the status: waiting-for-feedback We need additional information before we can continue label Jun 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) status: waiting-for-feedback We need additional information before we can continue type: enhancement A general enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SupplierClientRegistrationRepository for reactive stack

5 participants