java-webauthn-server icon indicating copy to clipboard operation
java-webauthn-server copied to clipboard

Spring reactive in CredentialRepository

Open igorlogvin opened this issue 1 year ago • 5 comments

Hello! Our project is replacing regular spring with Spring Reactive (Mono, Flux, etc.). The yubico library does not support reactive contracts in the CredentialRepository. Is it possible to release a version on Reactive Spring?

igorlogvin avatar Sep 19 '24 08:09 igorlogvin

Pardon my ignorance - what is a reactive contract? Is this related to #219 (asynchronous methods)?

emlun avatar Sep 20 '24 10:09 emlun

Pardon my ignorance - what is a reactive contract? Is this related to #219 (asynchronous methods)?

No, it not what I mean.

https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html

In our case, we want to use Mono<Object> or Flux return in CredentialRepository interface methods. If it’s possible.

As example:

Mono<Set<PublicKeyCredentialDescriptor>> getCredentialIdsForUsername(String username);

igorlogvin avatar Sep 20 '24 12:09 igorlogvin

Ok, that looks to me like another way to describe asynchronous programming. The Reactor docs even say so themselves:

Reactor [...] integrates directly with the Java 8 functional APIs, notably CompletableFuture [...]. It offers composable asynchronous sequence APIs — [...] Mono [...]

The reply in #219 still stands: this is not possible with the current CredentialRepository API; it is of course possible to release a new version that supports it, but it would be a major undertaking to refactor the API for it. In particular, we'd have to think hard about how to make it as widely compatible as possible so we don't lock it specifically to Spring, for example. On the bright side, we now have the experimental CredentialRepositoryV2 and related interfaces - they may be a good testing grounds for an async API.

As in #219 I'm still positive towards the idea, but I cannot promise any concrete timeline for this. You're more than welcome to contribute a proposal as a pull request if you'd like to help accelerate the effort.

emlun avatar Sep 20 '24 13:09 emlun

Thanks for explaining. Hope this feature will created soon.

igorlogvin avatar Oct 07 '24 15:10 igorlogvin

Reopened for linked issues history

igorlogvin avatar Oct 16 '24 13:10 igorlogvin