Re: [GNAP] generic HTTP resource type

Fabien Imbault <> Wed, 28 July 2021 04:29 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id 5141E3A1B70 for <>; Tue, 27 Jul 2021 21:29:34 -0700 (PDT)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -2.097
X-Spam-Status: No, score=-2.097 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: (amavisd-new); dkim=pass (2048-bit key)
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id iaEBHwH7aD8y for <>; Tue, 27 Jul 2021 21:29:29 -0700 (PDT)
Received: from ( [IPv6:2607:f8b0:4864:20::d32]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by (Postfix) with ESMTPS id EBEB63A1B6D for <>; Tue, 27 Jul 2021 21:29:28 -0700 (PDT)
Received: by with SMTP id n19so1506536ioz.0 for <>; Tue, 27 Jul 2021 21:29:28 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=wHsXuhd3vcClQ5PmHGpp28iz+N/7UCOrfWrnJP7lZSc=; b=dscEFCZYkdtGDeqrWH1t2V7FgCytHOfjGyMeB/IWzd7B62Qjl/M1rgjKN24Wgs/0V1 uSpNlwgpAROC3IEyduXLxHAjjhuLGIsU8dZWV6uzg5bByxtiDHxZWRLPWoZi5UJtNSSK Q1XZEg6+jikTu1TQM1Ob9mkt1o3JMwnyjTJ5HcdVR/j+p9A22Sc5VzYA8mAcmOSErdYn S6CknrWYEXrytcAGtyFNDs0GE7QmvuZ+mIJ1gFoguzB2EZGOonVHg/SoY0hjHJIA3pCG IfQqeGhGCd8kq7j+33dHILUDocw73KcCeUWT4dWt5hmQRMktvKq62CGRIdRIZdlCyMa9 4E7w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=wHsXuhd3vcClQ5PmHGpp28iz+N/7UCOrfWrnJP7lZSc=; b=Ql2Mgqs7T8ZRm3mKOYujmqLGTV5a0lnnRsgBvu8FdbNM3wbdo3zJDR8ZdzD4Mo7Pzd gHcFvRHOUKRO5US5Ubgbi6NaTtvmh0fq1cdp7Cg3V12v403be9A4QOLKDTNboIYxCqY+ iUDK7Dywqq4HEf5PMbNLbeA7K6I1TYyywcKrO6rg5IRN8MDGwl/sLyOTtcNhS2eAqmhZ 82M/LXNsuj3DWzZzUEiVTlxqPDymjkMLHlGsX1ihSX8zsrvDBV2hZBIUn5gRzqHoMRdP vZaQMNoEtde8kWKpjt+ew5ifIpDxsRCNPH68Xo1hYSrMPmXAAaVlIfmnzY2H5SARYsKj 7tnA==
X-Gm-Message-State: AOAM5300uM+SConav6mkJpEpC7p2Q1Gsm4arD2OmINxx5tSzQgR9Hu28 wU6rsZgGyVp9wKXK0N7c72z1FTQvZf/7WgpyNA8=
X-Google-Smtp-Source: ABdhPJwCNAp47LTDAvA0bx8KEOago05QXKT79beIuEl31LkeZ5bbI1MGNEg1apOVdsgN32VPyuNCnPqAB3Sw5Pyp3hI=
X-Received: by 2002:a02:a38f:: with SMTP id y15mr24995727jak.108.1627446566998; Tue, 27 Jul 2021 21:29:26 -0700 (PDT)
MIME-Version: 1.0
References: <YP9bhNFEs3YPw1AD@eh> <>
In-Reply-To: <>
From: Fabien Imbault <>
Date: Wed, 28 Jul 2021 06:29:15 +0200
Message-ID: <>
To: Justin Richer <>
Cc: Jamey Sharp <>, GNAP Mailing List <>
Content-Type: multipart/alternative; boundary="00000000000084571305c8276ec6"
Archived-At: <>
Subject: Re: [GNAP] generic HTTP resource type
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: GNAP <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-Subscribe: <>, <>
X-List-Received-Date: Wed, 28 Jul 2021 04:29:34 -0000


The proposal answers a real problem. As a consequence, I'd tend to think it
makes a good candidate in core, as chairs where looking for an appendix
related to use cases anyways.

For the details of what implementing that use case requires, any of the
possibilities mentioned by Justin seem fine to me, although it kind of
illustrates why I wasn't so fond of "type" in the first place (not in
principle, but what it should represent, i.e. a unique namespace).


Le mer. 28 juil. 2021 à 01:26, Justin Richer <> a écrit :

> Hi Jamey,
> Thanks for this thorough writeup, this is a fascinating idea, and as an
> individual I think it has some merit and warrants discussion. Now the
> question is what to do with that idea, and I can think of a handful of
> immediate options, detailed below. There are probably others.
> But first, a note: the “type” element serves an important namespace
> function. In particular, a general-purpose “type” value would want to be
> something that’s collision-resistant, like a URI. Which URI gets used here
> depends a lot on where this definition would go. The documentation that
> defines the “type” element also defines the structure and contents of the
> object that contains the “type” element, so the language about what goes in
> “locations”, “datatypes”, and “actions” would all be defined with the
> “type” value. Of course, it’s entirely up to an AS/RS to map a given “type”
> value to a given definition set, but that’s the nature of protecting
> general APIs with a common security protocol — we can’t dictate that people
> interpret things a particular way.
> These are the options for this type definition I can think of right now:
> 1) Defined as an appendix in GNAP Core. We can also use it in some
> examples. It remains optional to interpret or support for a given AS/RS.
> 2) Defined in a separate GNAP document.
> 3) Defined by a different WG. Perhaps HTTP-API would want to look at this?
> 4) Defined on a webpage on the internet, without a standards body behind
> it. The URL would be the URL of the document.
> All of these have equal functionality inside of GNAP because of the
> supremacy of the AS/RS in this decision. And even better, anything defined
> for this part of GNAP is immediately usable in OAuth 2 RAR as well.
> I’d like to hear what people think about this proposal — is it a good one,
> is it worth writing down, and if so, where?
>  — Justin
> > On Jul 26, 2021, at 9:04 PM, Jamey Sharp <> wrote:
> >
> > In today's meeting, I asked about applying GNAP as the HTTP
> authentication method for arbitrary HTTP resources, such as static files,
> in the same way that Basic and Digest auth can be used today. Justin asked
> me to share the question here.
> >
> > Because the current draft includes RS-first AS discovery using the
> standard WWW-Authenticate response header, it might work for this use case
> as-is, but I think it can be improved.
> >
> > First: Am I correct in thinking that two access tokens retrieved from
> the same AS, by the same end user, with the same "access" list, should be
> indistinguishable to the client? Specifically, if a client receives two
> `WWW-Authenticate: GNAP` headers with the same "as_url" and "access"
> parameters, can it reuse the access token it got for the first request on
> the second request, without consulting the AS again?
> >
> > If so, I think the WWW-Authenticate "access" parameter is equivalent to
> the "realm" parameter defined in RFC7235 and used in RFC7617 Basic auth.
> (Perhaps for consistency with HTTP auth, it should in fact be called
> "realm" when used in that header? RFC7235 even uses "scope" terminilogy to
> describe it.)
> >
> > Without additional provisions, which I'm pretty sure are not currently
> in GNAP, checking for matching realm/access parameters still requires an
> extra unauthenticated request any time the client needs to access a URL it
> hasn't visited before, even if the response turns out to indicate that an
> earlier access token can be reused.
> >
> > RFC7617 defines somewhat magic rules for when a client can proactively
> provide Basic-scheme credentials to a URL where it hasn't previously seen a
> WWW-Authenticate header, in order to avoid a round-trip in the common case
> where the same credentials are accepted at similar URLs. In theory, GNAP
> could specify something similar to make RS-first AS discovery more
> efficient, but that level of magic seems dangerous to me.
> >
> > The Digest auth scheme in RFC7616 instead allows the server (in this
> context, the RS) to give an explicit list of URL prefixes which accept the
> same credentials, in the WWW-Authenticate "domain" parameter. I think
> that's a closer fit for GNAP, but rather than making it a header parameter,
> I think it's best to fold it into the token's access rights.
> >
> > I propose standardizing a definition of a "type" value for the rights
> request that describes HTTP access rights generically, rather than
> describing actions appropriate to a specific API. I think that would make
> GNAP usable anywhere that Basic or Digest auth are currently used. It might
> also enable a wide variety of RESTful APIs and HTTP-based standards to use
> GNAP without needing to define custom rights types.
> >
> > Here is a concrete suggestion as a starting point for discussion:
> >
> > "access": [{
> >  "type": "http",
> >  "locations": [""],
> >  "datatypes": ["text/html", "image/*"],
> >  "actions": ["GET", "PUT", "DELETE"]
> > }]
> >
> > A resource request must match all fields to be allowed. If "datatypes"
> or "actions" are empty or absent, then all are permitted. (Permitting
> nothing is the same as not granting any rights at all.) The "locations"
> field is required to be present and non-empty though, and might work like
> the "domain" parameter in Digest: "The client can use this list to
> determine the set of URIs for which the same authentication information may
> be sent: any URI that has a URI in this list as a prefix [...] MAY be
> assumed to be in the same protection space."
> >
> > This allows a client to request a limited set of methods or access to a
> limited portion of the protection space. It also allows the AS to inform
> the client of exactly which requests it may use the access token on, which
> may be different than what the client requested.
> >
> > If I'm reading the current draft correctly, if a client sends an opaque
> resource reference like `"access": "WallyWorld"`, then the AS may choose to
> send back a non-opaque description of the rights granted by the returned
> access token, such as the above example for the hypothetical "http" rights
> type. Is that right?
> >
> > I suppose the downside of the AS transforming an opaque reference into a
> full rights description is that the client can't indicate which rights
> types it understands. If a CMS supports a proprietary API for editing blog
> posts, but also supports WebDAV for file attachments, it might not be clear
> which rights type to use, yeah?
> >
> > So here's an additional proposal: a client wishing to use this generic
> HTTP rights type should (must?) explicitly request it in the "access"
> rights request (and may also include the resource reference given in the
> "access" parameter of the WWW-Authenticate header, if any). It must specify
> the exact request URL in the "locations" field, and may also specify the
> method it tried to use in "actions". As usual, the AS may return a token
> granting rights to a wider range of locations or methods and is recommended
> to return the actual granted rights.
> >
> > I hope that's reasonably clear and would love to discuss this further.
> >
> > Jamey
> >
> > --
> > TXAuth mailing list
> >
> >
> --
> TXAuth mailing list