Captain-P-Goldfish / SCIM-SDK

a scim implementation as described in RFC7643 and RFC7644
https://github.com/Captain-P-Goldfish/SCIM/wiki
BSD 3-Clause "New" or "Revised" License
122 stars 38 forks source link

patch fails for complex-reference-type when using bulk #614

Closed Captain-P-Goldfish closed 7 months ago

Captain-P-Goldfish commented 7 months ago

Version 1.22.0 is affected. Works with version 1.21.x

{
  "schemas": [
    "urn:ietf:params:scim:api:messages:2.0:BulkRequest"
  ],
  "failOnErrors": 0,
  "Operations": [
    {
      "method": "POST",
      "bulkId": "84c55382-5515-43c3-9eed-7dc44017f6bf",
      "path": "/OidcConfigs",
      "data": {
        "schemas": [
          "urn:governikus:params:scim:schemas:custom:2.0:OidcConfig"
        ],
        "idpUrl": "http://localhost:1234/oidc",
        "clientId": "ClientID",
        "clientSecret": "123",
        "redirectUrl": "http://localhost:8080/local/client/oidc",
        "meta": {
          "version": "W/\"0\""
        }
      }
    },
    {
      "method": "PATCH",
      "bulkId": "ba212806-6327-4781-8a1b-8636b317cf01",
      "path": "/Tenants",
      "data": {
        "schemas": [
          "urn:ietf:params:scim:api:messages:2.0:PatchOp"
        ],
        "Operations": [
          {
            "path": "adminOidcConfig",
            "op": "add",
            "value": [
              {
                "type": "ScimOidcConfig",
                "value": "bulkId:84c55382-5515-43c3-9eed-7dc44017f6bf"
              }
            ]
          },
          {
            "path": "enabled",
            "op": "replace",
            "value": [
              false
            ]
          }
        ]
      }
    }
  ]
}
{
  "schemas": [
    "urn:ietf:params:scim:schemas:core:2.0:ResourceType"
  ],
  "id": "Tenant",
  "name": "Tenant",
  "description": "a representation of an organization that serves for several OAuth2 clients as superior base",
  "schema": "urn:governikus:params:scim:schemas:custom:2.0:Tenant",
  "endpoint": "/Tenants",
  "urn:gold:params:scim:schemas:extension:url:2.0:ResourceTypeFeatures": {
    "singletonEndpoint": true
  }
}
{
      "name": "adminOidcConfig",
      "type": "complex",
      "description": "reference to the admin application oidc configuration",
      "mutability": "readWrite",
      "returned": "default",
      "uniqueness": "none",
      "multiValued": false,
      "required": false,
      "caseExact": false,
      "subAttributes": [
        {
          "name": "value",
          "description": "The id of the SCIM resource representing this reference.",
          "type": "string",
          "mutability": "readWrite",
          "returned": "default",
          "uniqueness": "none",
          "multiValued": false,
          "caseExact": false,
          "required": true
        },
        {
          "name": "type",
          "description": "The type of the SCIM resource",
          "type": "reference",
          "mutability": "readWrite",
          "returned": "default",
          "uniqueness": "none",
          "multiValued": false,
          "caseExact": false,
          "required": false
        },
        {
          "name": "$ref",
          "description": "The URI of the SCIM resource",
          "type": "reference",
          "mutability": "readOnly",
          "returned": "default",
          "uniqueness": "none",
          "multiValued": false,
          "caseExact": false,
          "required": false,
          "referenceTypes": [
            "resource"
          ]
        }
      ]
    }
Value for attribute 'urn:governikus:params:scim:schemas:custom:2.0:Tenant:adminOidcConfig' must be an object but was '["{\"type\":\"ScimOidcConfig\",\"value\":\"5\"}"]'
de.captaingoldfish.scim.sdk.common.exceptions.BadRequestException: Value for attribute 'urn:governikus:params:scim:schemas:custom:2.0:Tenant:adminOidcConfig' must be an object but was '["{\"type\":\"ScimOidcConfig\",\"value\":\"5\"}"]'
                at de.captaingoldfish.scim.sdk.server.patch.PatchRequestHandler$AbstractPatchOperationHandler.handleComplexAttribute(PatchRequestHandler.java:626)
                at de.captaingoldfish.scim.sdk.server.patch.PatchRequestHandler$AbstractPatchOperationHandler.handleSingleResourceField(PatchRequestHandler.java:471)
                at de.captaingoldfish.scim.sdk.server.patch.PatchRequestHandler$PatchPathHandler.handlePathOperation(PatchRequestHandler.java:747)
                at de.captaingoldfish.scim.sdk.server.patch.PatchRequestHandler$PatchPathHandler.access$300(PatchRequestHandler.java:690)
                at de.captaingoldfish.scim.sdk.server.patch.PatchRequestHandler.handleSinglePatchOperation(PatchRequestHandler.java:262)
                at de.captaingoldfish.scim.sdk.server.patch.PatchRequestHandler.handlePatchRequest(PatchRequestHandler.java:215)
                at de.captaingoldfish.scim.sdk.server.endpoints.ResourceEndpointHandler.lambda$patchResource$24(ResourceEndpointHandler.java:1024)
                at de.captaingoldfish.scim.sdk.server.interceptor.NoopInterceptor.doAround(NoopInterceptor.java:21)
                at de.captaingoldfish.scim.sdk.server.endpoints.ResourceEndpointHandler.patchResource(ResourceEndpointHandler.java:1011)
                at de.captaingoldfish.scim.sdk.server.endpoints.ResourceEndpoint.resolveRequest(ResourceEndpoint.java:290)
                at de.captaingoldfish.scim.sdk.server.endpoints.BulkEndpoint.handleSingleBulkOperation(BulkEndpoint.java:300)
                at de.captaingoldfish.scim.sdk.server.endpoints.BulkEndpoint.handleBulkOperationList(BulkEndpoint.java:192)
                at de.captaingoldfish.scim.sdk.server.endpoints.BulkEndpoint.bulk(BulkEndpoint.java:128)
                at de.captaingoldfish.scim.sdk.server.endpoints.ResourceEndpoint.handleRequest(ResourceEndpoint.java:186)
                at de.governikus.autent.consent.admin.api.controller.ScimController.handleScimRequest(ScimController.java:98)
                at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
                at java.base/java.lang.reflect.Method.invoke(Method.java:580)