Skip to content

Deprecate and remove USERS.USER_TYPE. #1064

@ibodrov

Description

@ibodrov

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)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions