concord icon indicating copy to clipboard operation
concord copied to clipboard

Deprecate and remove USERS.USER_TYPE.

Open ibodrov opened this issue 11 months ago • 0 comments

Let's deprecate and remove USERS.USER_TYPE.

The value is currently used as a key for UserInfoProvider when retrieving UserInfo. The original idea was to retrieve UserInfo using the provider determined on the user's first login, i.e. when the USERS record is created. Reasoning being that we needed UserInfo not only for the current user, but also for users that might not be currently logged in so we better save the original provider with the user entry.

Unfortunately, this scheme doesn't work for users that log in using multiple providers, e.g. same user logging in using LDAP today and OIDC tomorrow. There are already some situations when we swap USER_TYPES dynamically to match the current user's current realm.

I propose:

  • deprecate Java enum UserType and all its uses (drop/null the column eventually)
  • remove UserInfoProvider#create - user creation should be handled by UserManager, not by extension points
  • retrieve UserInfoProviders by using the current user's UserPrincipal#getRealm value and the only place where we should use UserInfoProviders directly are:
    • UserManager, when creating new user entries
    • when fetching UserInfo for the current user
  • all other places where we need UserInfo we should fetch it from the DB
  • provider-specific stuff like UserLdapGroupSynchronizer can still use "their own" UserInfoProviders freely whenever needed

Am I missing anything? Are there any other uses for USERS.USER_TYPE (besides being a confusing equivalent of UserPrincipal#getRealm)?

ibodrov avatar Jan 03 '25 16:01 ibodrov