Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for user attribute value with length bigger than 255 symbols #132

Merged
merged 7 commits into from
Jul 9, 2019
Merged

fix for user attribute value with length bigger than 255 symbols #132

merged 7 commits into from
Jul 9, 2019

Conversation

AndrewChubatiuk
Copy link
Contributor

Hello again, @mrparkers
Prepared a small PR for a case when user attribute value is bigger than 255 symbols.
Keycloak web automatically splits too long strings into a slice with a string length up to 255 symbols.
My PR does the same

@AndrewChubatiuk
Copy link
Contributor Author

PR is ready, but build is failing from time to time

@mrparkers
Copy link
Owner

Thanks for the PR, would you be able to add a test for the scenario you're fixing?

Andrew Chubatiuk and others added 3 commits July 8, 2019 17:02
@AndrewChubatiuk
Copy link
Contributor Author

@mrparkers Yep. Just added

Copy link
Owner

@mrparkers mrparkers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@mrparkers mrparkers merged commit 2b1794b into mrparkers:master Jul 9, 2019
@tomrutsaert
Copy link
Contributor

@AndrewChubatiuk, since this PR was added to master I have certain user test that always fail on my platform.
Below You 'll see a snippet from the test log.
Am I doing something wrong?

=== RUN   TestAccKeycloakUserTemplateIdentityProviderMapper_basicUpdateAll
--- PASS: TestAccKeycloakUserTemplateIdentityProviderMapper_basicUpdateAll (1.06s)
=== RUN   TestAccKeycloakUser_basic
--- FAIL: TestAccKeycloakUser_basic (0.74s)
    testing.go:568: Step 0 error: After applying this step, the plan was not empty:
        
        DIFF:
        
        UPDATE: keycloak_user.user
          attributes.terraform-attribute-kxubj8jlam: "qkqgbzi1pn6ka4o9cyqcej49hg4hepddskwkvj02eh1tyld3v01jrxdp6jhgud7wvv76wpx1jrz3fsekjm66op9oz7a1ydmtm6v3gnpo3v8ib232p290fxaimpqa2myobs18u3x4jn8wktm8bx0ojfiqh7kxwm1dr70pe3mqcaa7cf8gzxgsrzn36y7yc60u6aacfqwjjvolk7qtdw912qmvkkffppmkctvsnv0ezs84d7q4asmowmc60k99boptjr3gz0ihcnow373e17x2asx3ikrasylpueu9t2apii9s" => "ld3v01jrxdp6jhgud7wvv76wpx1jrz3fsekjm66op9oz7a1ydmtm6v3gnpo3v8ib232p290fxaimpqa2myobs18u3x4jn8wktm8bx0ojfiqh7kxwm1dr70pe3mqcaa7cf8gzxgsrzn36y7yc60u6aacfqwjjvolk7qtdw912qmvkkffppmkctvsnv0ezs84d7q4asmowmc60k99boptjr3gz0ihcnow373e17x2asx3ikrasylpueu9t2apii9sqkqgbzi1pn6ka4o9cyqcej49hg4hepddskwkvj02eh1ty"
          email:                                     "" => ""
          enabled:                                   "true" => "true"
          federated_identity.#:                      "0" => "0"
          first_name:                                "" => ""
          id:                                        "b6725e2f-612c-46bf-b066-f7bad5ae4aa6" => "b6725e2f-612c-46bf-b066-f7bad5ae4aa6"
          initial_password.#:                        "0" => "0"
          last_name:                                 "" => ""
          realm_id:                                  "terraform-1xk3nolzik" => "terraform-1xk3nolzik"
          username:                                  "terraform-user-pbxco3v7ua" => "terraform-user-pbxco3v7ua"
        
        
        
        STATE:
        
        keycloak_realm.realm:
          ID = terraform-1xk3nolzik
          provider = provider.keycloak
          access_code_lifespan = 1m0s
          access_code_lifespan_login = 30m0s
          access_code_lifespan_user_action = 5m0s
          access_token_lifespan = 5m0s
          access_token_lifespan_for_implicit_flow = 15m0s
          account_theme = 
          action_token_generated_by_admin_lifespan = 12h0m0s
          action_token_generated_by_user_lifespan = 5m0s
          admin_theme = 
          display_name = 
          duplicate_emails_allowed = false
          edit_username_allowed = false
          email_theme = 
          enabled = true
          login_theme = 
          login_with_email_allowed = false
          offline_session_idle_timeout = 720h0m0s
          offline_session_max_lifespan = 1440h0m0s
          realm = terraform-1xk3nolzik
          refresh_token_max_reuse = 0
          registration_allowed = false
          registration_email_as_username = false
          remember_me = false
          reset_password_allowed = false
          sso_session_idle_timeout = 30m0s
          sso_session_max_lifespan = 10h0m0s
          verify_email = false
        keycloak_user.user:
          ID = b6725e2f-612c-46bf-b066-f7bad5ae4aa6
          provider = provider.keycloak
          attributes.terraform-attribute-kxubj8jlam = qkqgbzi1pn6ka4o9cyqcej49hg4hepddskwkvj02eh1tyld3v01jrxdp6jhgud7wvv76wpx1jrz3fsekjm66op9oz7a1ydmtm6v3gnpo3v8ib232p290fxaimpqa2myobs18u3x4jn8wktm8bx0ojfiqh7kxwm1dr70pe3mqcaa7cf8gzxgsrzn36y7yc60u6aacfqwjjvolk7qtdw912qmvkkffppmkctvsnv0ezs84d7q4asmowmc60k99boptjr3gz0ihcnow373e17x2asx3ikrasylpueu9t2apii9s
          email = 
          enabled = true
          first_name = 
          last_name = 
          realm_id = terraform-1xk3nolzik
          username = terraform-user-pbxco3v7ua
        
          Dependencies:
            keycloak_realm.realm
=== RUN   TestAccKeycloakUser_withInitialPassword
--- PASS: TestAccKeycloakUser_withInitialPassword (1.33s)
=== RUN   TestAccKeycloakUser_createAfterManualDestroy
--- FAIL: TestAccKeycloakUser_createAfterManualDestroy (0.83s)
    testing.go:568: Step 0 error: After applying this step, the plan was not empty:
        
        DIFF:
        
        UPDATE: keycloak_user.user
          attributes.terraform-attribute-cwnpq9ot7e: "3ol7ny8pl143p9hb7ey3mivi2n0g164mm8swiim14rijpnkefqnra4egnjbh8oycixrvt1q30jpiustzs8zgm2ikmix969rp6ngx9zs4xp2vr4fylss4qwgppl3u09jw73vstv4groj6m0qwdacd4obd87xkgauaqkk1ik4dba2hpnnv4ynstv4jsahx6hx8it7qorzyviruhpzatj38ac7y2hl34ar7a899qsvzk0gdmk6mn3y1x1fz8i2gg3fhpuykwi8k1pnuga4fgc3l0rr1bqqc6brye40aa2l1wbda" => "nkefqnra4egnjbh8oycixrvt1q30jpiustzs8zgm2ikmix969rp6ngx9zs4xp2vr4fylss4qwgppl3u09jw73vstv4groj6m0qwdacd4obd87xkgauaqkk1ik4dba2hpnnv4ynstv4jsahx6hx8it7qorzyviruhpzatj38ac7y2hl34ar7a899qsvzk0gdmk6mn3y1x1fz8i2gg3fhpuykwi8k1pnuga4fgc3l0rr1bqqc6brye40aa2l1wbda3ol7ny8pl143p9hb7ey3mivi2n0g164mm8swiim14rijp"
          email:                                     "" => ""
          enabled:                                   "true" => "true"
          federated_identity.#:                      "0" => "0"
          first_name:                                "" => ""
          id:                                        "689285e4-de75-4b14-b533-b78746b9d4d9" => "689285e4-de75-4b14-b533-b78746b9d4d9"
          initial_password.#:                        "0" => "0"
          last_name:                                 "" => ""
          realm_id:                                  "terraform-8h4sts42j4" => "terraform-8h4sts42j4"
          username:                                  "terraform-user-xyg2jsox6j" => "terraform-user-xyg2jsox6j"
        
        
        
        STATE:
        
        keycloak_realm.realm:
          ID = terraform-8h4sts42j4
          provider = provider.keycloak
          access_code_lifespan = 1m0s
          access_code_lifespan_login = 30m0s
          access_code_lifespan_user_action = 5m0s
          access_token_lifespan = 5m0s
          access_token_lifespan_for_implicit_flow = 15m0s
          account_theme = 
          action_token_generated_by_admin_lifespan = 12h0m0s
          action_token_generated_by_user_lifespan = 5m0s
          admin_theme = 
          display_name = 
          duplicate_emails_allowed = false
          edit_username_allowed = false
          email_theme = 
          enabled = true
          login_theme = 
          login_with_email_allowed = false
          offline_session_idle_timeout = 720h0m0s
          offline_session_max_lifespan = 1440h0m0s
          realm = terraform-8h4sts42j4
          refresh_token_max_reuse = 0
          registration_allowed = false
          registration_email_as_username = false
          remember_me = false
          reset_password_allowed = false
          sso_session_idle_timeout = 30m0s
          sso_session_max_lifespan = 10h0m0s
          verify_email = false
        keycloak_user.user:
          ID = 689285e4-de75-4b14-b533-b78746b9d4d9
          provider = provider.keycloak
          attributes.terraform-attribute-cwnpq9ot7e = 3ol7ny8pl143p9hb7ey3mivi2n0g164mm8swiim14rijpnkefqnra4egnjbh8oycixrvt1q30jpiustzs8zgm2ikmix969rp6ngx9zs4xp2vr4fylss4qwgppl3u09jw73vstv4groj6m0qwdacd4obd87xkgauaqkk1ik4dba2hpnnv4ynstv4jsahx6hx8it7qorzyviruhpzatj38ac7y2hl34ar7a899qsvzk0gdmk6mn3y1x1fz8i2gg3fhpuykwi8k1pnuga4fgc3l0rr1bqqc6brye40aa2l1wbda
          email = 
          enabled = true
          first_name = 
          last_name = 
          realm_id = terraform-8h4sts42j4
          username = terraform-user-xyg2jsox6j
        
          Dependencies:
            keycloak_realm.realm
=== RUN   TestAccKeycloakUser_updateRealm
--- PASS: TestAccKeycloakUser_updateRealm (1.06s)
=== RUN   TestAccKeycloakUser_updateUsername
--- FAIL: TestAccKeycloakUser_updateUsername (0.81s)
    testing.go:568: Step 0 error: After applying this step, the plan was not empty:
        
        DIFF:
        
        UPDATE: keycloak_user.user
          attributes.terraform-attribute-gwjhlv0tbb: "8la4wd4gsecdkr1qvraqorp18qkzt9cstekquluq6pmkdl2onp7gqv4fdxh9g66i1e4jgnx7wwvk76mytiyfemqg4geimeti3h73fa6vj8qpxl8v18thep4zgl7hrgcy40s4x4nhjve2aetb3fntexnh6ixpovu4yxdhixovexqnlctu3tnj2gowrgkkkiys7n4s7xnk4vcqje3azrd6gvjzyntp3dq8qdsm7pbhppagqkrstgq7jvecyu3tzv3rr906yf0zaw1f1bkfz161rbhmw70uj4yy23z1tu7qjoo6" => "l2onp7gqv4fdxh9g66i1e4jgnx7wwvk76mytiyfemqg4geimeti3h73fa6vj8qpxl8v18thep4zgl7hrgcy40s4x4nhjve2aetb3fntexnh6ixpovu4yxdhixovexqnlctu3tnj2gowrgkkkiys7n4s7xnk4vcqje3azrd6gvjzyntp3dq8qdsm7pbhppagqkrstgq7jvecyu3tzv3rr906yf0zaw1f1bkfz161rbhmw70uj4yy23z1tu7qjoo68la4wd4gsecdkr1qvraqorp18qkzt9cstekquluq6pmkd"
          email:                                     "" => ""
          enabled:                                   "true" => "true"
          federated_identity.#:                      "0" => "0"
          first_name:                                "" => ""
          id:                                        "b96b0dba-e838-4232-bf38-f1680de9df0a" => "b96b0dba-e838-4232-bf38-f1680de9df0a"
          initial_password.#:                        "0" => "0"
          last_name:                                 "" => ""
          realm_id:                                  "terraform-grcei49yyf" => "terraform-grcei49yyf"
          username:                                  "terraform-user-h8gfajlhc9" => "terraform-user-h8gfajlhc9"
        
        
        
        STATE:
        
        keycloak_realm.realm:
          ID = terraform-grcei49yyf
          provider = provider.keycloak
          access_code_lifespan = 1m0s
          access_code_lifespan_login = 30m0s
          access_code_lifespan_user_action = 5m0s
          access_token_lifespan = 5m0s
          access_token_lifespan_for_implicit_flow = 15m0s
          account_theme = 
          action_token_generated_by_admin_lifespan = 12h0m0s
          action_token_generated_by_user_lifespan = 5m0s
          admin_theme = 
          display_name = 
          duplicate_emails_allowed = false
          edit_username_allowed = false
          email_theme = 
          enabled = true
          login_theme = 
          login_with_email_allowed = false
          offline_session_idle_timeout = 720h0m0s
          offline_session_max_lifespan = 1440h0m0s
          realm = terraform-grcei49yyf
          refresh_token_max_reuse = 0
          registration_allowed = false
          registration_email_as_username = false
          remember_me = false
          reset_password_allowed = false
          sso_session_idle_timeout = 30m0s
          sso_session_max_lifespan = 10h0m0s
          verify_email = false
        keycloak_user.user:
          ID = b96b0dba-e838-4232-bf38-f1680de9df0a
          provider = provider.keycloak
          attributes.terraform-attribute-gwjhlv0tbb = 8la4wd4gsecdkr1qvraqorp18qkzt9cstekquluq6pmkdl2onp7gqv4fdxh9g66i1e4jgnx7wwvk76mytiyfemqg4geimeti3h73fa6vj8qpxl8v18thep4zgl7hrgcy40s4x4nhjve2aetb3fntexnh6ixpovu4yxdhixovexqnlctu3tnj2gowrgkkkiys7n4s7xnk4vcqje3azrd6gvjzyntp3dq8qdsm7pbhppagqkrstgq7jvecyu3tzv3rr906yf0zaw1f1bkfz161rbhmw70uj4yy23z1tu7qjoo6
          email = 
          enabled = true
          first_name = 
          last_name = 
          realm_id = terraform-grcei49yyf
          username = terraform-user-h8gfajlhc9
        
          Dependencies:
            keycloak_realm.realm
=== RUN   TestAccKeycloakUser_updateWithInitialPasswordChangeDoesNotReset
--- PASS: TestAccKeycloakUser_updateWithInitialPasswordChangeDoesNotReset (1.32s)
=== RUN   TestAccKeycloakUser_updateInPlace
--- PASS: TestAccKeycloakUser_updateInPlace (0.89s)
=== RUN   TestAccKeycloakUser_unsetOptionalAttributes
--- FAIL: TestAccKeycloakUser_unsetOptionalAttributes (1.06s)
    testing.go:568: Step 1 error: After applying this step and refreshing, the plan was not empty:
        
        DIFF:
        
        UPDATE: keycloak_user.user
          attributes.terraform-attribute-vtiezs4f2d: "ft9pc7x86yix7nx9zri6w3p6g6jzzvft3flyrf7hmgrd6mnhxukeiv7vpftia72v320jxyi9yxw8anqj7gp2k0uzvhsrgfzn6afwukhmvrw2gxoi00qhehpneh66x2kbtmq38rr8czro68xivhw6bjvvtflly7279rpfll47x3mc7d6exhuv967t1fk7xm9crhclii2uyg0of2qgy1oycijz1bb4v9fdw1igjygkdzhpxnyryv92ui47r7r0qeduabvt4wo6392" => "7nx9zri6w3p6g6jzzvft3flyrf7hmgrd6mnhxukeiv7vpftia72v320jxyi9yxw8anqj7gp2k0uzvhsrgfzn6afwukhmvrw2gxoi00qhehpneh66x2kbtmq38rr8czro68xivhw6bjvvtflly7279rpfll47x3mc7d6exhuv967t1fk7xm9crhclii2uyg0of2qgy1oycijz1bb4v9fdw1igjygkdzhpxnyryv92ui47r7r0qeduabvt4wo6392ft9pc7x86yix"
          email:                                     "" => ""
          enabled:                                   "true" => "true"
          federated_identity.#:                      "0" => "0"
          first_name:                                "" => ""
          id:                                        "ce52f059-688d-4b8b-a92d-c6de1d4dee17" => "ce52f059-688d-4b8b-a92d-c6de1d4dee17"
          initial_password.#:                        "0" => "0"
          last_name:                                 "" => ""
          realm_id:                                  "terraform-veymkkf76i" => "terraform-veymkkf76i"
          username:                                  "terraform-user-3zjfz78lq2" => "terraform-user-3zjfz78lq2"
        
        
        
        STATE:
        
        keycloak_realm.realm:
          ID = terraform-veymkkf76i
          provider = provider.keycloak
          access_code_lifespan = 1m0s
          access_code_lifespan_login = 30m0s
          access_code_lifespan_user_action = 5m0s
          access_token_lifespan = 5m0s
          access_token_lifespan_for_implicit_flow = 15m0s
          account_theme = 
          action_token_generated_by_admin_lifespan = 12h0m0s
          action_token_generated_by_user_lifespan = 5m0s
          admin_theme = 
          display_name = 
          duplicate_emails_allowed = false
          edit_username_allowed = false
          email_theme = 
          enabled = true
          login_theme = 
          login_with_email_allowed = false
          offline_session_idle_timeout = 720h0m0s
          offline_session_max_lifespan = 1440h0m0s
          realm = terraform-veymkkf76i
          refresh_token_max_reuse = 0
          registration_allowed = false
          registration_email_as_username = false
          remember_me = false
          reset_password_allowed = false
          sso_session_idle_timeout = 30m0s
          sso_session_max_lifespan = 10h0m0s
          verify_email = false
        keycloak_user.user:
          ID = ce52f059-688d-4b8b-a92d-c6de1d4dee17
          provider = provider.keycloak
          attributes.terraform-attribute-vtiezs4f2d = ft9pc7x86yix7nx9zri6w3p6g6jzzvft3flyrf7hmgrd6mnhxukeiv7vpftia72v320jxyi9yxw8anqj7gp2k0uzvhsrgfzn6afwukhmvrw2gxoi00qhehpneh66x2kbtmq38rr8czro68xivhw6bjvvtflly7279rpfll47x3mc7d6exhuv967t1fk7xm9crhclii2uyg0of2qgy1oycijz1bb4v9fdw1igjygkdzhpxnyryv92ui47r7r0qeduabvt4wo6392
          email = 
          enabled = true
          first_name = 
          last_name = 
          realm_id = terraform-veymkkf76i
          username = terraform-user-3zjfz78lq2
        
          Dependencies:
            keycloak_realm.realm
=== RUN   TestAccKeycloakUser_validateLowercaseUsernames
--- PASS: TestAccKeycloakUser_validateLowercaseUsernames (0.01s)
=== CONT  TestAccKeycloakDataSourceOpenidClientAuthorizationPolicy_basic
=== CONT  TestAccKeycloakDataSourceRealmKeys_filterByAlgorithms
=== CONT  TestAccKeycloakDataSourceRealmKeys_basic
=== CONT  TestAccKeycloakDataSourceOpenidClient_basic
--- PASS: TestAccKeycloakDataSourceRealmKeys_filterByAlgorithms (1.52s)
--- PASS: TestAccKeycloakDataSourceRealmKeys_basic (1.52s)
--- PASS: TestAccKeycloakDataSourceOpenidClientAuthorizationPolicy_basic (1.70s)
--- PASS: TestAccKeycloakDataSourceOpenidClient_basic (1.73s)
FAIL
FAIL    github.com/mrparkers/terraform-provider-keycloak/provider       277.366s
makefile:31: recipe for target 'testacc2' failed
make: *** [testacc2] Error 1
tom@tom-HP-EliteBook-850-G3:~/projects/go/src/github.com/tomrutsaert/terraform-provider-keycloak$ 

@tomrutsaert
Copy link
Contributor

Ubuntu 18.04.2 LTS

@mrparkers mrparkers mentioned this pull request Aug 19, 2019
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants