Skip to content

Remove isTotp() and setTotp() from UserRepresentation #25727

Open

Description

@jonkoops

Both isTotp() and setTotp() have been deprecated for 7+ years since #3258 was landed. They will have to be either removed with a clear migration guide for consumers, or we should un-deprecate this functionality.

Activity

  1. added
    area/core
    on Dec 20, 2023
  2. added this to the 24.0.0 milestone on Dec 20, 2023
  3. jonkoops commented on Dec 20, 2023

    @jonkoops
    ContributorAuthor

    @keycloak/core can someone from the core team pass judgement on this?

  4. jonkoops commented on Dec 20, 2023

    @jonkoops
    ContributorAuthor

    I am inclined to remove the deprecation, as this field is part of the public REST API, and therefore it is very likely we have users relying on this feature. Unless there is a recommended way users can use a similar field (not aware of any such field existing).

  5. aharpour commented on Dec 20, 2023

    @aharpour

    Hi,
    In my project, I have implemented a custom user profile page using org.keycloak:keycloak-admin-client to communicate with Keycloak. Currently, I am using isTotp() method to show the users whether they have enabled 2FA or not. If this method is removed then I will have to use UserResource#credentials method and that means one more reset call. I am already making two reset calls every time I fetch a user's profile. One to fetch user representation and another for fetching the user's groups. If isTotp() is removed I will have to make 3 calls. I believe groups and the status of 2FA are an essential part of a user profile. Therefore one should be able to fetch them using a single reset call.

  6. mposolda commented on Jan 11, 2024

    @mposolda
    Contributor

    My vote is to either keep it deprecated or remove it, but not un-deprecate it. This method was introduced at the time when we had totp as the only possible 2-factor mechanism. But since now we have WebAuthn and Recovery-codes (and maybe custom 2-factor authentication providers), this method does not have much value as it is specific only to totp .

    So IMO we should either:

    1. Remove this without any replacement
    2. Keep it as it is (but that is not ideal)
    3. Fill the user by default with his credentials when user endpoint GET method is called
    4. Same like (3), but add some parameter to user endpoint GET method (like boolean parameter includeCredentials)

    My vote is to either (1), then (2). I would not rather do (3) or (4) as we have dedicated endpoint to retrieve user's credential and the only concern is performance in being able to retrieve everything in single REST call as pointed by @aharpour .

    But in general, isn't it better pattern to rather have various data to be returned in multiple REST calls rather than have 1 huge chunk of data returned in the single REST call? Note that single REST call also has performance implications for all those not interested in additional data like credentials.

    @aharpour Also note that you can add custom REST extension if performance is really concern for you. In this REST extension, you would be able to return current user together with his credentials.

  7. pedroigor commented on Jan 11, 2024

    @pedroigor
    Contributor

    I would also add that if the concern is making a client simpler, you can (more complexity in the design) add a BFF (backend for frontend) to act as a facade to the server.

  8. aharpour commented on Jan 25, 2024

    @aharpour

    @mposolda I apologize for the delay in my response. Among the four options presented, I would vote for (2). But, I would like to propose a fifth alternative. The purpose of this boolean was to convey whether two-factor authentication (2FA) had been activated. Since "TOTP" was the sole form of 2FA supported at the time, they named the boolean "totp." Had they designated it "twoFactorAuthentication" instead, this field would not have required depreciating after more authentication methods were introduced. Instead, it could have been updated to become true so long as any type of 2FA had been activated.
    Therefore, I suggest removing the "totp" field and instead introducing a boolean that indicates whether any form of two-factor authentication has been activated.

  9. modified the milestones: 24.0.0, 25.0.0 on Feb 26, 2024
  10. removed this from the 25.0.0 milestone on May 16, 2024
  11. 1 remaining item

  12. modified the milestones: 26.0.0, 27.0.0 on Oct 1, 2024
  13. alexted commented on Oct 1, 2024

    @alexted

    one more year, haha!

  14. pedroigor commented on Oct 1, 2024

    @pedroigor
    Contributor

    one more year, haha!

    Or a bit more ... We lost this one and we cannot aford more risks now right before releasing 26.

  15. added theissue type on Oct 2, 2025
  16. modified the milestones: 26.6.0, 27.0.0 on Nov 11, 2025
  17. mposolda commented on Mar 23, 2026

    @mposolda
    Contributor

    Another related issue (which has also PR): #43587

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/corekind/eolteam/core-authnteam/core-iamteam/core-shared

    Type

    Fields

    No fields configured for eol.

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions