Creating an in-memory user in a javascript authenticator

Hi there,

I have a use-case for keycloak in which we have an existing database covered by an API that I have been using for my users. In time, I want to move them to the keycloak local user storage, but until then I’d like to create a custom authenticator to:

  1. Check keycloak local storage to see if user exists - if they do, log them in. If they don’t, proceed to
  2. Hit the REST API endpoint to verify the credentials. If this is successful, return a valid authenticated user. I do not wish to persist this back to the local storage.

Is it actually possible to create an in-memory authenticated user based on the endpoint-validated credentials (and maybe some other properties)? That is, generate a token for them, as if they were an authenticated user. At the moment, it doesn’t seem so, I can’t seem to instantiate a UserModel.

TIA!