A library that integrates webauthn4j in a
Play framework app,
providing the server-side registration and verification services of
the Web Authentication standard.
This library provides a PasskeyAuth class, which gives you:
- a verification action that can be composed with other action builders
- a controller that can be included in a Play routes file to perform standard passkey operations.
The library is storage-agnostic. You must decide how best to store passkey data in your infrastructure. Consequently, the integration depends on the implementation of some service traits.
Add to your build.sbt:
libraryDependencies += "com.gu" %% "play-passkey-auth" % "<version>"See the example directory for a complete, working Play application that demonstrates:
- Registering new passkeys
- Authenticating with passkeys
- Managing (listing and deleting) passkeys
- In-memory repository implementations
Run the example:
sbt "project example" runThen open http://localhost:9000 in your browser.
- Define a User instance for your user type.
- Implement a PasskeyRepository.
- Implement a PasskeyChallengeRepository.
- Implement a CreationDataExtractor.
- Implement an AuthenticationDataExtractor.
- Implement a PasskeyNameExtractor.
- Implement a UserExtractor.
- Bundle the extractors and user action into a PasskeyAuthContext.
- Create a HostApp describing your application (name and URI).
- Pass the repositories,
HostApp, andPasskeyAuthContextinto a PasskeyAuth.
show actual Scala/Play code how to handle common failure cases how it fits into existing Play apps