Help for creating authenticator that allows Login without username

We need to provide a Login option based upon the following flow:

  1. Keycloak asks user to login via UUID
  2. If user with UUID is found then login that user
  3. If UUID is not found proceed to username & password form
  4. After user logs in he is required to register a UUID for Login pruposes if he has not done so

First I was looking into the “secret question” example for SPIs, but it looks like there is no way to lookup a credential without a user, or a user with only a credential value.

My current approach would be to try and use an attribute as there a searchForUserByUserAttribute method in UserQueryProvider.

Is that a sensible approach? Are there any examples with a similar usecase?