Re: [scim] [EXTERNAL] Query on a specific known resource

Phillip Hunt <phil.hunt@independentid.com> Thu, 07 July 2022 03:25 UTC

Return-Path: <phil.hunt@independentid.com>
X-Original-To: scim@ietfa.amsl.com
Delivered-To: scim@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id ED464C15AD37 for <scim@ietfa.amsl.com>; Wed, 6 Jul 2022 20:25:12 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.802
X-Spam-Level:
X-Spam-Status: No, score=-1.802 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, HTTPS_HTTP_MISMATCH=0.1, MIME_QP_LONG_LINE=0.001, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_BLOCKED=0.001, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=unavailable autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=independentid-com.20210112.gappssmtp.com
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9-5QE_Uqwxvi for <scim@ietfa.amsl.com>; Wed, 6 Jul 2022 20:25:08 -0700 (PDT)
Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id E828BC15AD35 for <scim@ietf.org>; Wed, 6 Jul 2022 20:25:08 -0700 (PDT)
Received: by mail-pg1-x535.google.com with SMTP id 73so685708pgb.10 for <scim@ietf.org>; Wed, 06 Jul 2022 20:25:08 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=independentid-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=HdFiEeegsTmucuDi+sWGstOjQxSw400sp/+S7K2p2n4=; b=Yd7alIayzi02/VWGrjpbybaU1FC0ygsuwOuShRamQVl5ifRv52Q8h/dkprsG0+ZdRF 2BIkl1zz7+0h2IaMlVpenpZ+EfdAo8wrfiYCLP8LAT2ekio7b8GomNfCP6Y1Uf9p83j3 m9NefdMojdR62LVzq3u5ijPU/avERWzQYaPl0JH5KoPcV1UZCVkumYeSARk/i6yLiKag z7m2I4plQT084I3/r0R8ve5Zul14ua4J8+PuSaqSlWTwKE1CfGFRBIGFvNPUugkP9tMw AsMHaoT/BwSCV1mkj/73gpynBHeD4CafIBsvCtoa37MG66txH2gBQpjUAdAB3lRQlqka ZD3A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=HdFiEeegsTmucuDi+sWGstOjQxSw400sp/+S7K2p2n4=; b=HKE/bbPZ5GB0LuKy2Y5t/ZqAijG/cU0FO6GhHrXrpnhJrkj+yrVjVeTZGodIa7eo9Z neKzZjOJexfMVXteRNbMnXge8nW6fhwoIyDpaWIWt7/XjsIIGE6EbdGksSdfY5GSXnb7 W5dBbxfSVQ++glkcV9axhgSIwnw6LDRvwHt70rLd28nfL2/jgV+PMtUBN7TdvIXce+L0 Qf5OLl5ubbn4nDYcFRoKyUbrOO5J8S19X+2OiUXlzzhtDsNOVqNaIdK0pQMkqA9fzPaX CdV+rdWaZmcpQi0l8REsQ+5ZTiMfRAf9m/lgUeZ7y3lSSv6SIw//syHyVYNQ2oAPgoQ0 xaRA==
X-Gm-Message-State: AJIora/2Ghrom0QleaRajr3juBq+sjhB1vbhpm0E/qvuyd2Bqgq53vAr OeDI2ovWW8/fyVQeP4+92rx3yBrPvTmjQg==
X-Google-Smtp-Source: AGRyM1vQzp9LOu8Z7B5psjcxnOqJ6IF+siu6UNDnJdGl4tXG+GUSZPXTeJTlsM075+PIvNJc95cjkw==
X-Received: by 2002:a05:6a00:24cc:b0:50d:58bf:5104 with SMTP id d12-20020a056a0024cc00b0050d58bf5104mr49748660pfv.36.1657164307762; Wed, 06 Jul 2022 20:25:07 -0700 (PDT)
Received: from smtpclient.apple (node-1w7jr9qjhqzxo2irur3rkwjhu.ipv6.telus.net. [2001:569:7316:ae00:517c:b248:a1e:fab2]) by smtp.gmail.com with ESMTPSA id a185-20020a624dc2000000b0051e7b6e8b12sm2334562pfb.11.2022.07.06.20.25.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 06 Jul 2022 20:25:06 -0700 (PDT)
Content-Type: multipart/alternative; boundary="Apple-Mail-D4E9DE8B-57A3-4F5C-9BA7-1FB378578083"
Content-Transfer-Encoding: 7bit
From: Phillip Hunt <phil.hunt@independentid.com>
Mime-Version: 1.0 (1.0)
Date: Wed, 06 Jul 2022 20:25:05 -0700
Message-Id: <E7E656BF-E866-4768-AF88-E5FCAE90CDA8@independentid.com>
References: <MN2PR00MB07189D4A9DA54A11131E9896FF839@MN2PR00MB0718.namprd00.prod.outlook.com>
Cc: Julien Schneider <julien@audriga.com>, scim@ietf.org
In-Reply-To: <MN2PR00MB07189D4A9DA54A11131E9896FF839@MN2PR00MB0718.namprd00.prod.outlook.com>
To: Danny Zollner <Danny.Zollner=40microsoft.com@dmarc.ietf.org>
X-Mailer: iPhone Mail (19F77)
Archived-At: <https://mailarchive.ietf.org/arch/msg/scim/iAot-nOigrMXs-G9wpq2Qku0J88>
Subject: Re: [scim] [EXTERNAL] Query on a specific known resource
X-BeenThere: scim@ietf.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: Simple Cloud Identity Management BOF <scim.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/scim>, <mailto:scim-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/scim/>
List-Post: <mailto:scim@ietf.org>
List-Help: <mailto:scim-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/scim>, <mailto:scim-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 07 Jul 2022 03:25:13 -0000

All forms of queries (via GET or POST) required a ListResponse per sec 3.4.2. 

It does not matter if only one resource is returnable.  This is important because if there is no match, total results is 0 even if it could only be one match.  

“ Responses MUST be identified using the following URI:
   "urn:ietf:params:scim:api:messages:2.0:ListResponse".  The following
   attributes are defined for responses:

   totalResults  The total number of results returned by the list or
      query operation.  The value may be larger than the number of
      resources returned, such as when returning a single page (see
      Section 3.4.2.4) of results where multiple pages are available.
      REQUIRED.

   Resources  A multi-valued list of complex objects containing the
      requested resources.  This MAY be a subset of the full set of
      resources if pagination (Section 3.4.2.4) is requested.  REQUIRED
      if "totalResults" is non-zero.

   startIndex  The 1-based index of the first result in the current set
      of list results.  REQUIRED when partial results are returned due
      to pagination.

   itemsPerPage  The number of resources returned in a list response
      page.  REQUIRED when partial results are returned due to
      pagination.“

Phil

> On Jul 6, 2022, at 7:51 PM, Danny Zollner <Danny.Zollner=40microsoft.com@dmarc.ietf.org> wrote:
> 
> 
> Hi Julien,
>  
> RFC 7644 section 3.4.2 specifically is talking about queries. Retrieving or modifying known resources (i.e.: GET /Users/12345 ) does not require a ListResponse type response. A query of GET /Users?filter=displayname contains “contoso.com” or GET /Users?attributes=userName would require a ListResponse type response, as it does not identify a specific resource in the query URL via ID value (i.e.: “12345” in the previous example). On the other hand, GET /Users/12345?attributes=userName does not require the ListResponse type response as it does identify a specific resource.
>  
> To explicitly answer the final question in your email – the expected response to GET /Users/2819c223-7f76-453a-919d-413861904646?attributes=userName would be the second example you provided.
>  
> Cheers,
>  
> Danny Zollner
>  
> From: scim <scim-bounces@ietf.org> On Behalf Of Julien Schneider
> Sent: Wednesday, July 6, 2022 3:41 AM
> To: scim@ietf.org
> Subject: [EXTERNAL] [scim] Query on a specific known resource
>  
> Some people who received this message don't often get email from julien@audriga.com. Learn why this is important
> Hi all,
> 
> I have a question about queries performed against a SCIM resource object (like "/Users/{id}").
> 
> The RFC (https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2) states:
> Responses MUST be identified using the following URI:
>    "urn:ietf:params:scim:api:messages:2.0:ListResponse"
> 
> If I understand correctly, that means the "schemas" parameter of the response to those queries must be set to:
> "schemas":["urn:ietf:params:scim:api:messages:2.0:ListResponse"]
> 
> While I understand how that applies to queries on a resource type endpoint (like "/Users") or on the SCIM server root, I don't understand how that applies to queries on a specific resource object.
> If I understand correctly, queries on a specific resource object actually are quite identical to "retrieving a known resource" (https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.1) which are a GET on a specific resource, like:
> GET /Users/2819c223-7f76-453a-919d-413861904646
> Responses to those requests should have the "schemas" parameter set to the resource schema(s):
> {
>      "schemas":["urn:ietf:params:scim:schemas:core:2.0:User"],
>      "id":"2819c223-7f76-453a-919d-413861904646",
> ...
> }
> 
> Now, how should the response to the following query should look like? And to what value should the "schemas" parameter of the response be set?
> GET /Users/2819c223-7f76-453a-919d-413861904646?attributes=userName
> 
> Should it be:
>    {
>      "schemas":["urn:ietf:params:scim:api:messages:2.0:ListResponse"],
>      "totalResults":1,
>      "Resources":[
>        {
>          "id":"2819c223-7f76-453a-919d-413861904646",
>          "userName":"bjensen"
>        }
>      ]
>    }
> 
> Or something like:
>    {
>      "schemas":["urn:ietf:params:scim:schemas:core:2.0:User"],
>      "id":"2819c223-7f76-453a-919d-413861904646",
>      "meta":{
>        "resourceType":"User",
>        "created":"2011-08-01T18:29:49.793Z",
>        "lastModified":"2011-08-01T18:29:49.793Z",
>        "location":
>    "https://example.com/v2/Users/2819c223-7f76-453a-919d-413861904646",
>        "version":"W\/\"f250dd84f0671c3\""
>      },
>      "userName":"bjensen"
>    }
> 
> Thanks a lot in advance
> 
> -- 
> Julien Schneider
> Tel: +49 721 170293 16
> Fax: +49 721 170293 179
>  
> http://www.audriga.com | http://www.twitter.com/audriga
>  
> --------------------------------------------------------------------------
> audriga GmbH |  Alter Schlachthof 57  | 76137 Karlsruhe
> Sitz der Gesellschaft: Karlsruhe - Amtsgericht Mannheim - HRB 713034
> Geschäftsführer: Dr. Frank Dengler, Dr.-Ing. Hans-Jörg Happel
> --------------------------------------------------------------------------
> _______________________________________________
> scim mailing list
> scim@ietf.org
> https://www.ietf.org/mailman/listinfo/scim