Uploaded image for project: 'Red Hat build of Keycloak'
  1. Red Hat build of Keycloak
  2. RHBK-2767

Wrong organization claim assignment in JWT access token [GHI#37169]

XMLWordPrintable

    • False
    • Hide

      None

      Show
      None
    • False
    • RHBK-2757 - Release Red Hat Build of KeyCloak

      Before reporting an issue

      [x] I have read and understood the above terms for submitting issues, and I understand that my issue may be closed without action if I do not follow them.

      Area

      organizations

      Describe the bug

      User (that email domain matches domain already used in any organizations) without any organization assigned gets organization claim in access token witch is in my opinion very very unwanted situation.
      Issue occurs when we create user with email domain that is assigned to organization. Then even so user is not a part of the organization gets organization claim in access token. (user has no organization and organization has no users).
      Wrong claim is assigned only using client with real application - evaluation tool for that particular client works correctly.

      Version

      nightly

      Regression

      [x] The issue is a regression

      Expected behavior

      User with no organization has no organization claim - even if its email's domain name is the same as one used in existing organization.

      Actual behavior

      User with no organization gets organization token claim with real organization data.

      How to Reproduce?

      1. Create realm
      2. Enable organizations
      3. Set email as username
      4. Modify client scope "organization" in client scopes:
      1) Set as default
      !Image

      2) Modify default mapper 'organizations' in client scope

      !Image

         Before:
      

      !Image

         After:
      

      !Image

      5. Create client that will be used by real application.
      6. Ensure that scope organization is default
      7. Create organizations

      !Image

      9. Create user with mail that is used by one of organizations (do not assign to any organization)

      !Image
      Org also has no users:

      !Image
      11. Log in to application
      12. Token contains organization based on domain while user is not assigned to any domain

      !Image

      14. Evaluation tool works correctly

      !Image

      (wrote all steps I've done)

      Anything else?

      No response

              Unassigned Unassigned
              pvlha Pavel Vlha
              Keycloak Core IAM
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: