Yubico / java-webauthn-server

Server-side Web Authentication library for Java https://www.w3.org/TR/webauthn/#rp-operations
Other
479 stars 144 forks source link

Spring reactive in CredentialRepository #380

Open igorlogvin opened 2 months ago

igorlogvin commented 2 months ago

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?

emlun commented 2 months ago

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

igorlogvin commented 2 months ago

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 or Flux return in CredentialRepository interface methods. If it’s possible.

As example:

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

emlun commented 2 months ago

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.

igorlogvin commented 1 month ago

Thanks for explaining. Hope this feature will created soon.

igorlogvin commented 1 month ago

Reopened for linked issues history