Yubico / java-webauthn-server

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

Asynchronous credential repository support #219

Open jroper opened 1 year ago

jroper commented 1 year ago

The current credential repository interface requires that all the invoked methods are handled synchronously. This doesn't work if you're using an asynchronous database driver in an asynchronous web framework, such as on Play Framework, Akka HTTP, etc. It would be ideal if the java-webauthn-server core library could provide asynchronous alternatives, allowing database lookups to return CompletionStage etc.

emlun commented 1 year ago

Hi! This is a good idea, but it'll likely take some pretty significant refactoring to support. I'd been thinking the stateless design of the library would hopefully play nice with asynchronous architectures, but you're right that the nature of the "callbacks" in CredentialRepository throw a wrench in that.

I think async support shouldn't be too hard to implement, the main question is whether it can be done without breaking backwards compatibility. I can't give you a time frame just yet, but I'll try to look into the feasibility of it soon.