Uploaded image for project: 'OpenIDM'
  1. OpenIDM
  2. OPENIDM-11067

Update of Internal Users with PUT and PATCH is not working anymore

    Details

    • Verified Version/s:

      Description

      Since commits done for OPENIDM-10885 Update of Internal Users with PUT and PATCH is not working anymore

      A) Update with PUT

      Steps to reproduce:
      1) create an internal user

      curl --header "If-None-Match: *" --header "Content-Type: application/json" --header "X-OpenIDM-Password: openidm-admin" --header "X-OpenIDM-Username: openidm-admin" --data '{"roles":[{"_ref":"internal/role/openidm-admin"}],"password":"Th3passw0rd"}' --request PUT "http://localhost:8080/openidm/internal/user/put_without_rev"
      {
        "_id": "put_without_rev",
        "_rev": "0",
        "password": {
          "$crypto": {
            "value": {
              "algorithm": "SHA-256",
              "data": "aaIgGmxw3yJ+zJbTT2aVsz3RqP41hVHlT/1nOLlfB1oQQAkI3aE/9gN/1694p7tQ"
            },
            "type": "salted-hash"
          }
        },
        "roles": [
          {
            "_ref": "internal/role/openidm-admin"
          }
        ]
      }
      

      2) update internal user with PUT

      curl --header "X-OpenIDM-Username: openidm-admin" --header "X-OpenIDM-Password: openidm-admin" --header "Content-Type: application/json" --data '{"_id":"put_without_rev","roles":["openidm-user"],"password":"Th3passw0rd"}' --request PUT "curl http://localhost:8080/openidm/internal/user/put_without_rev"
      {
        "code": 500,
        "reason": "Internal Server Error",
        "message": "Internal Server Error"
      }
      

      And here is what we see in the log:

      [12] Jun 01, 2018 8:17:51 AM org.forgerock.openidm.health.HealthService setState
      INFO: OpenIDM ready OpenIDM version "6.5.0-SNAPSHOT" (build: 20180601023905, revision: 2d612ef) jenkins-OpenIDM-build-master-238
      [939] Jun 01, 2018 8:17:53 AM org.forgerock.openidm.servlet.internal.ServletConnectionFactory$3 lambda$handleRequestWithLogging$8
      WARNING: Resource exception: 500 Internal Server Error: "Internal Server Error"
      org.forgerock.json.resource.InternalServerErrorException: Internal Server Error
      	at org.forgerock.openidm.internal.InternalObjectSet.updateInstance(InternalObjectSet.java:865)
      	at org.forgerock.json.resource.InterfaceCollectionInstance.handleUpdate(InterfaceCollectionInstance.java:64)
      	at org.forgerock.json.resource.FilterChain$Cursor.handleUpdate(FilterChain.java:115)
      	at org.forgerock.json.resource.Resources$CollectionInstanceIdContextFilter.filterUpdate(Resources.java:526)
      	at org.forgerock.json.resource.FilterChain$Cursor.handleUpdate(FilterChain.java:113)
      	at org.forgerock.json.resource.FilterChain.handleUpdate(FilterChain.java:258)
      	at org.forgerock.json.resource.Router.handleUpdate(Router.java:344)
      	at org.forgerock.openidm.internal.impl.InternalObjectSetRequestHandler.handleUpdate(InternalObjectSetRequestHandler.java:109)
      

      B) update with PATCH

      It used to work with MySQL repo:

      curl --header "Content-Type: application/json" --header "X-OpenIDM-Password: openidm-admin" --header "X-OpenIDM-Username: openidm-admin" --data '[{"operation":"replace","field":"roles","value":[]}]' --request PATCH "http://localhost:8080/openidm/internal/user/user_patch"
      {"_id":"user_patch","_rev":"1","password":{"$crypto":{"value":{"algorithm":"SHA-256","data":"r64CMxpvfYhmR8qf0d9AcmVeACzmAi/R0uhiiaHcYvkoNzIPeeai1elmdHq7BZoa"},"type":"salted-hash"}},"roles":[]}
      

      but now it fails also:

      curl --header "Content-Type: application/json" --header "X-OpenIDM-Password: openidm-admin" --header "X-OpenIDM-Username: openidm-admin" --data '[{"operation":"replace","field":"roles","value":[]}]' --request PATCH "curl http://localhost:8080/openidm/internal/user/user_patch"
      {
        "code": 500,
        "reason": "Internal Server Error",
        "message": "Internal Server Error"
      }
      

      and with Embedded DJ repo we used to get a 400 (which was maybe a problem) but now we also get the 500 error.

      Note: PyForge command to test cRUD on Internal user and check the failure/fix:

      ./run-pybot.py --suite auth*.gen*.crud*  OpenIDM
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jbranch Jon Branch
                Reporter:
                laurent.bristiel Laurent Bristiel [X] (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: