Re: [OAUTH-WG] Token Mediating and session Information Backend For Frontend (TMI BFF)

Vittorio Bertocci <vittorio.bertocci@auth0.com> Sun, 14 February 2021 19:39 UTC

Return-Path: <vittorio.bertocci@auth0.com>
X-Original-To: oauth@ietfa.amsl.com
Delivered-To: oauth@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id E99F73A07DA for <oauth@ietfa.amsl.com>; Sun, 14 Feb 2021 11:39:01 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -0.197
X-Spam-Level:
X-Spam-Status: No, score=-0.197 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_FONT_LOW_CONTRAST=0.001, HTML_MESSAGE=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=auth0.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7Pfyu6psnItJ for <oauth@ietfa.amsl.com>; Sun, 14 Feb 2021 11:38:59 -0800 (PST)
Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id D1AC63A0650 for <oauth@ietf.org>; Sun, 14 Feb 2021 11:38:59 -0800 (PST)
Received: by mail-pj1-x102e.google.com with SMTP id t2so2625960pjq.2 for <oauth@ietf.org>; Sun, 14 Feb 2021 11:38:59 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=auth0.com; s=google; h=from:to:cc:subject:thread-topic:thread-index:date:message-id :references:in-reply-to:accept-language:content-language :mime-version; bh=3d7M4w+cg96ioi2OTOkHyyv5vlOT6RALXpy1+FcW1jg=; b=cC1kqZ8KvNGlpzRELI+sjoW1nCBEuaYetAyfIKP6ZCnAcMVV9TYu1UBXT5f+poQ7gF ua6Q3O4efAAuRH1VRhR2N0hWXHQcPzLDjQ30vU91iLVcKxPftmzWsRRnPS8prVKfqJXw DS3aq11CQwt2vnJMiLge/zmpWs5U5KB8+yFy77QKd5/BXu6NHIuyK+F1rMM73LcFLLbI qxhNFj8W6aiCqe7XNxf6FeH67oKzi+Z+9C1lebCE/4RYAi/RVruoFMSJfYNYQegB3Mf9 6PNNcgnbKCYAsGXjr9H17HZgsXKqDAQVshDz6iypbsOLs0VAppouXLL89k3h6kcEnHKq 9bSQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:thread-topic:thread-index :date:message-id:references:in-reply-to:accept-language :content-language:mime-version; bh=3d7M4w+cg96ioi2OTOkHyyv5vlOT6RALXpy1+FcW1jg=; b=bzVzj8rwXjIqeSxGrPWPF276OskADV3Lp1ck6Ziz8l2WizwwFSKuENO9ZgIjXYSkAL cF+d/cvQTfUCDBpaOL6r7OOYGsKx3FfnKwNZgOCq0Fyv43pZAHjRa0rTHlrlMwRLBQ3d tvVV+TkrproGRUUPUeseL1IhbjhL/JaHNHmLX7qzbziuPiBGfqKTsEfFW7cytnCKN+rm G3bYbEnh4kJGWIWjuES0+xLtYrnMjhgBNYZvyfdWpI9RYob7QTlJKoOcqoUaWNXyl520 K6t9+nuFL2Ak1/TV+J54djoy0Y6OWZqwUwj5xYDshlDbt7/feVxFKXjHLfpzrAEDwn7d brQw==
X-Gm-Message-State: AOAM532IwmwhwQgdtmCclkGSkTLG+on0DFn7xozefe+b0WL+WMZ3mCCy nDvYYN6YQmijvPavxkdU2nt9Fg==
X-Google-Smtp-Source: ABdhPJwSa5m1KAiO7P1NCVEbMnndIfCJ8nVKPSy/vDF3f5TPcD4Z2TbZts3kWYZzBYp0OwLFN9Rujw==
X-Received: by 2002:a17:90a:f497:: with SMTP id bx23mr12525584pjb.170.1613331539056; Sun, 14 Feb 2021 11:38:59 -0800 (PST)
Received: from CO6PR18MB4052.namprd18.prod.outlook.com ([2603:1036:301:402a::5]) by smtp.gmail.com with ESMTPSA id h8sm14278687pfv.154.2021.02.14.11.38.57 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 14 Feb 2021 11:38:58 -0800 (PST)
From: Vittorio Bertocci <vittorio.bertocci@auth0.com>
To: Warren Parad <wparad@rhosys.ch>, Stoycho Sleptsov <stoycho.sleptsov@gmail.com>
CC: Neil Madden <neil.madden@forgerock.com>, oauth <oauth@ietf.org>
Thread-Topic: [OAUTH-WG] Token Mediating and session Information Backend For Frontend (TMI BFF)
Thread-Index: AQHXAYASMR57RiKGBkS9HwYUcalSA6pXUL8AgAAaNoCAACuILIAAFosAgAALMgCAAAZ4gIAADE4AgAAfRYCAAATwgIAAH9sv
X-MS-Exchange-MessageSentRepresentingType: 1
Date: Sun, 14 Feb 2021 19:38:56 +0000
Message-ID: <CO6PR18MB40520FF440BAD7B312B29904AE899@CO6PR18MB4052.namprd18.prod.outlook.com>
References: <CAGL0X-qvLz=gG06Q3mL5yNs5f-eqSwxO-g=K=cDKdmC8VP+UEg@mail.gmail.com> <AE8B3F28-D7B3-4A70-8E0D-2F673970E008@forgerock.com> <CAGL0X-o4Aq6Ec0UviqLryrxn0ksetLhjkVfVoNf_Cjtda+MX8g@mail.gmail.com> <CAJot-L3BXNyM3L_74-W+y3cJzmG2UxPiovb3DHLbmBL66-53SQ@mail.gmail.com> <CAGL0X-rwM4Kc4qQSea+gaO7YORZgnJTHWyFM3VPcaJ2ceX527A@mail.gmail.com> <CAJot-L1UQweut9MmrFYr+4qRGLixEFoECHr_tdLf86w=uVR5ZA@mail.gmail.com>
In-Reply-To: <CAJot-L1UQweut9MmrFYr+4qRGLixEFoECHr_tdLf86w=uVR5ZA@mail.gmail.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-Exchange-Organization-SCL: -1
X-MS-TNEF-Correlator:
X-MS-Exchange-Organization-RecordReviewCfmType: 0
Content-Type: multipart/alternative; boundary="_000_CO6PR18MB40520FF440BAD7B312B29904AE899CO6PR18MB4052namp_"
MIME-Version: 1.0
Archived-At: <https://mailarchive.ietf.org/arch/msg/oauth/Ye3HyV0hBzIELLo4xF0Tud96Gu4>
Subject: Re: [OAUTH-WG] Token Mediating and session Information Backend For Frontend (TMI BFF)
X-BeenThere: oauth@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: OAUTH WG <oauth.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/oauth>, <mailto:oauth-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/oauth/>
List-Post: <mailto:oauth@ietf.org>
List-Help: <mailto:oauth-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/oauth>, <mailto:oauth-request@ietf.org?subject=subscribe>
X-List-Received-Date: Sun, 14 Feb 2021 19:39:02 -0000

In the TMI-BFF topology, the backend and frontend developer are the same person. The operations TMI-BFF describes are the functional equivalent of what the JS code of one SPA app using a code+PKCE SDK would do when retrieving previously obtaining tokens from the store in order to perform an API call. Whereas such an app would make that call in memory (and result in the same operations described here, either use a previously saved access token matching the requirements of the API call, or use artifacts like RTs to request a new access token matching the request) in TMI-BFF al the logic and persistence layer are in the backend, hence that query becomes a request to the backend instead of a local function call.
The advantages have been described in other branches of this thread, but TL;DR- a lot of the token requesting work can be performed more reliably (eg less things can go wrong) from a confidential client and it’s easier for SDK developers to package it (see existing middlewares vs JS SDKs). Note that for the app developer this might still look like the same flow, asking a JS SDK to get the token the app needs to call an API, but the JS SDK would be dramatically simpler than the one performing code+PKCE in the user agent and entail communication between frontend a backend, hence the need to define how that communication happens if we want developers to be able to mix and match frontend and backend dev stacks.
Again, this does not necessarily add security to the code+PKCE in the user agent model (which remains the only game in town for backendless SPAs), but it does make things simpler for the frontend developer and requires less advanced capabilities in the AS.

From: Warren Parad <wparad@rhosys.ch>
Date: Sunday, February 14, 2021 at 09:45
To: Stoycho Sleptsov <stoycho.sleptsov@gmail.com>
Cc: Neil Madden <neil.madden@forgerock.com>, Vittorio Bertocci <vittorio.bertocci@auth0.com>, oauth <oauth@ietf.org>
Subject: Re: [OAUTH-WG] Token Mediating and session Information Backend For Frontend (TMI BFF)

Correct it would never need to be used to authenticate a client, as a client is always offline and can directly use the backchannel. You would never need the front channel to authenticate a client, however you might need the front channel to authorize a client to access user resources offline. Is that what you are talking about, i.e. the offline refresh_token authorization code flow?

If yes, then the standard would be to use the authorization code flow requesting as you've mentioned. Although that flow already exists and well established, and without any issues, having a standard specifying how to communicate with the client doesn't seem to be useful, as you only need to pass an auth code and the issuer to the client. But since these endpoints are never exposed nor need to have interoperability between different owners (i.e. the owner of the front-channel is different from the owner of the back-channel), what's the benefit of specifying the explicit endpoints necessary for the BFF to have?


[Image removed by sender.]

Warren Parad

Founder, CTO
Secure your user data and complete your authorization architecture. Implement Authress<https://authress.io>.


On Sun, Feb 14, 2021 at 6:27 PM Stoycho Sleptsov <stoycho.sleptsov@gmail.com<mailto:stoycho.sleptsov@gmail.com>> wrote:
Thanks Warren,

as I see you and Neil have the same idea,
but as of this moment I think this method is not a valid option for authenticating
a client according to the draft-ietf-oauth-v2-1.

On the other hand, authenticating the client through the BFF
seems conforming to the spec., but in the case when the access token is used
in the browser in fact, I am afraid that it can be regarded as
some kind of "deception" of the AS.

It seems the frontend SPA is not the easiest way to go with oauth...

Stoycho.

On Sun, 14 Feb 2021 at 17:35, Warren Parad <wparad@rhosys.ch<mailto:wparad@rhosys.ch>> wrote:
redirect_uri and use PKCE via the code verifier.


[Image removed by sender.]

Warren Parad

Founder, CTO
Secure your user data and complete your authorization architecture. Implement Authress<https://authress.io>.


On Sun, Feb 14, 2021 at 3:51 PM Stoycho Sleptsov <stoycho.sleptsov@gmail.com<mailto:stoycho.sleptsov@gmail.com>> wrote:
Thanks a lot for your answer Neil,

as I am no expert (yet :-)) in security I was afraid to rely on
redirect_uri for authentication of the client,
but I will consider that option as more trustworthy now.

(it is also not very clear for me which part of the app can be
regarded as the redirect_uri owner, the BFF or the loaded frontend
SPA, but maybe it is not so important)

If you had the two options for authentication of the frontend SPA
client - the redirect_uri on the one hand, and the Basic
authentication with client secret through the BFF on the other, which
one would you recommend?

On Sun, 14 Feb 2021 at 16:28, Neil Madden <neil.madden@forgerock.com<mailto:neil.madden@forgerock.com>> wrote:
>
> Public clients are implicitly authenticated by their ownership of the registered redirect_uri. This why it’s important to use a redirect_uri for which ownership can be reasonably established, such as HTTPS endpoints with exact URI matching.
>
> There are more things that can go wrong with that (see the security BCP), but it can be made reasonably secure.
>
> — Neil
>
> > On 14 Feb 2021, at 13:48, Stoycho Sleptsov <stoycho.sleptsov@gmail.com<mailto:stoycho.sleptsov@gmail.com>> wrote:
> >
> > 
> > I would like to add my reasons about the "Why are developers creating BFF for their frontends to communicate with an AS",
> > with the objective to verify if they are valid.
> >
> > I need the client app. to be authenticated at the AS (to determine if it is a first-party app., for example).
> > If we decide to implement our client as a frontend SPA , then we have no other option except through a BFF, as PKCE does not help for authentication.
> >
> > Or is it considered a bad practice to do that?
> >
> > Regards,
> > Stoycho.
> > _______________________________________________
> > OAuth mailing list
> > OAuth@ietf.org<mailto:OAuth@ietf.org>
> > https://www.ietf.org/mailman/listinfo/oauth
>
> --
> ForgeRock values your Privacy <https://www.forgerock.com/your-privacy>