Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat custom user #1978

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Feat custom user #1978

wants to merge 2 commits into from

Conversation

FreddyDevelop
Copy link
Contributor

Description

Add custom user id to a user. This custom user id is only used for verifying assertions from imported passkeys.
New passkeys are created with the user id (uuid) from Hanko.

Implementation

Added a new column to the user table. Check in WebauthnService.VerifyAssertionResponse if the userHandle in the response is a uuid, if not treat it as a custom user id. Get the user based on the custom user ID and verify the response against the user credentials.
Also return the custom user id in the JWT.

Tests

  • Create a passkey for a user with an user which is not a uuid. (E.g. with https://github.com/teamhanko/passkeys)
  • Copy the webauthn credential into the database (currently there is no other way to import a webauthn credential)
  • Associate the credential to an existing user or create a new user
  • Add the custom user id to the user
  • Try to login using this new credential

Keep in mind that the webauthn credential must be created and used with the same RP ID.

Todos

  • Extend the user import to also import a custom user id

Additional context

This is needed when a relying party already has implemented passkeys, but wants to migrate to Hanko and does not use uuids as user identifiers.

Add custom user ID to a user. This custom user ID is only used for verifying assertions from imported passkeys.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🆕 New
Development

Successfully merging this pull request may close these issues.

1 participant