Skip to content

Commit 58377a7

Browse files
committed
BFF - "Configuring authentication with an OpenID Connect Endpoint" #742
1 parent f9c26e4 commit 58377a7

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

src/content/docs/bff/fundamentals/session/handlers.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,14 @@ You typically use the following two ASP.NET Core authentication handlers to impl
1717
* the OpenID Connect authentication handler to interact with the remote OIDC / OAuth token service, e.g. Duende IdentityServer
1818
* the cookie handler to do local session management
1919

20-
Furthermore, the BFF plumbing relies on the configuration of the ASP.NET Core default authentication schemes. This describes how the two handlers share the work.
20+
The BFF relies on the configuration of the ASP.NET Core default authentication schemes. Both the OpenID Connect authentication
21+
handler and cookie handler need to be configured, with the ASP.NET Core authentication system default schemes specified:
2122

22-
OpenID Connect for *challenge* and *signout* - cookies for all the other operations:
23+
* `DefaultScheme` should be the cookie handler, so the BFF can do local session management;
24+
* `DefaultChallengeScheme` should be the OpenID Connect handler, so the BFF defaults to remote authentication;
25+
* `DefaultSignOutScheme` should be the OpenID Connect handler, so the BFF uses remote sign-out.
26+
27+
A minimal configuration looks like this:
2328

2429
```csharp
2530
builder.Services.AddAuthentication(options =>
@@ -36,14 +41,20 @@ builder.Services.AddAuthentication(options =>
3641
});
3742
```
3843

44+
Now let's look at some more details!
45+
3946
## The OpenID Connect Authentication Handler
47+
4048
The OIDC handler connects the application to the authentication / access token system.
49+
It can use any OpenID Connect provider: [Duende IdentityServer](https://duendesoftware.com/products/identityserver/),
50+
[Microsoft Entra ID](https://www.microsoft.com/en-us/security/business/identity-access/microsoft-entra-id), [Auth0](https://auth0.com/),
51+
[Google Cloud Identity Platform](https://cloud.google.com/identity-platform), [Amazon Cognito](https://aws.amazon.com/cognito/), and more.
4152

42-
The exact settings depend on the OIDC provider and its configuration settings. We recommend:
53+
The exact settings to use depend on the OIDC provider and its configuration settings. We recommend to:
4354

4455
* use authorization code flow with PKCE
4556
* use a *response_mode* of *query* since this plays nicer with *SameSite* cookies
46-
* use a strong client secret. Since the BFF can be a confidential client, it is totally possible to use strong client authentication like JWT assertions, JAR or MTLS. Shared secrets work as well of course.
57+
* use a strong client secret. Since the BFF can be a confidential client, it is possible to use strong client authentication like JWT assertions, JAR, or ,TLS. Shared secrets work as well.
4758
* turn off inbound claims mapping
4859
* save the tokens into the authentication session so they can be automatically managed
4960
* request a refresh token using the *offline_access* scope
@@ -82,6 +93,7 @@ builder.Services.AddAuthentication().AddOpenIdConnect("oidc", options =>
8293
The OIDC handler will use the default sign-in handler (the cookie handler) to establish a session after successful validation of the OIDC response.
8394

8495
## The Cookie Handler
96+
8597
The cookie handler is responsible for establishing the session and manage authentication session related data.
8698

8799
Things to consider:

0 commit comments

Comments
 (0)