Skip to content

Commit 3ab9898

Browse files
committed
Add WebAuthn/Passkey documentation to README
1 parent 6bf3bf4 commit 3ab9898

1 file changed

Lines changed: 47 additions & 0 deletions

File tree

README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ This version uses:
7171

7272
- **Authentication & Security**
7373
- Username/password authentication
74+
- WebAuthn/Passkey passwordless login (biometrics, security keys)
75+
- Passkey management (register, rename, delete)
7476
- OAuth2 login with Google, Facebook, and Keycloak
7577
- Role-based access control
7678
- CSRF protection
@@ -376,6 +378,39 @@ To enable SSO:
376378
377379
Then update your OAuth2 providers' callback URLs to use the ngrok domain.
378380
381+
---
382+
383+
#### **WebAuthn / Passkeys**
384+
385+
The demo app includes full WebAuthn/Passkey support for passwordless login. Users can register passkeys (biometrics, security keys) from their profile page and use them to log in without a password.
386+
387+
**Configuration** (in `application.yml`):
388+
```yaml
389+
user:
390+
webauthn:
391+
enabled: true # Enable passkey support
392+
rpId: localhost # Must match your domain
393+
rpName: Spring User Framework Demo # Display name shown during registration
394+
allowedOrigins: http://localhost:8080 # Must match browser origin exactly
395+
```
396+
397+
**Important**: You must also add the WebAuthn endpoints to your unprotected URIs:
398+
```yaml
399+
user:
400+
security:
401+
unprotectedURIs: ...,/webauthn/authenticate/**,/login/webauthn
402+
```
403+
404+
**How it works:**
405+
- **Register a passkey**: Log in with username/password, go to your profile page, and click "Add Passkey"
406+
- **Log in with passkey**: On the login page, click the "Sign in with a Passkey" button
407+
- **Manage passkeys**: From your profile page, rename or delete registered passkeys
408+
409+
**Development notes:**
410+
- HTTP works on `localhost` without HTTPS
411+
- For testing on other devices, use ngrok (`ngrok http 8080`) and update `rpId` and `allowedOrigins` to match the ngrok domain
412+
- The database tables (`user_entities`, `user_credentials`) are created automatically by Hibernate
413+
379414
### Environment Variables
380415
381416
For production deployments, use environment variables instead of hardcoding values:
@@ -640,6 +675,18 @@ Solution:
640675
4. Verify Keycloak realm and client settings
641676
```
642677
678+
#### WebAuthn/Passkey Issues
679+
**Problem**: Passkey registration or login fails
680+
```
681+
Solution:
682+
1. Verify user.webauthn.enabled is true in application.yml
683+
2. Check that rpId matches your domain (localhost for local dev)
684+
3. Ensure allowedOrigins matches the exact browser URL (including port)
685+
4. Verify /webauthn/authenticate/** and /login/webauthn are in unprotectedURIs
686+
5. For non-localhost testing, HTTPS is required - use ngrok
687+
6. Check browser console for WebAuthn API errors
688+
```
689+
643690
#### Email Not Sending
644691
**Problem**: Registration emails not received
645692
```

0 commit comments

Comments
 (0)