Skip to content

Commit b3c6972

Browse files
authored
Merge branch 'main' into mb/standardize-editions
2 parents 0c36695 + 7926afe commit b3c6972

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+999
-431
lines changed

src/content/docs/accesstokenmanagement/advanced/client-assertions.mdx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ public class ClientAssertionService(IOptionsSnapshot<ClientCredentialsClient> op
4444
var descriptor = new SecurityTokenDescriptor
4545
{
4646
Issuer = options1.ClientId!.ToString(),
47-
Audience = options1.TokenEndpoint!.ToString(),
47+
48+
// Set the audience to the url of identity server. Do not use the tokenurl to build the autority.
49+
Audience = "https://--url-to-authority-here--",
50+
4851
Expires = DateTime.UtcNow.AddMinutes(1),
4952
SigningCredentials = GetSigningCredential(),
5053
@@ -105,7 +108,9 @@ public class ClientAssertionService(IOptionsSnapshot<ClientCredentialsClient> op
105108
var descriptor = new SecurityTokenDescriptor
106109
{
107110
Issuer = options1.ClientId,
108-
Audience = options1.TokenEndpoint,
111+
112+
// Set the audience to the url of identity server. Do not use the tokenurl to build the autority.
113+
Audience = "https://--url-to-authority-here--",
109114
Expires = DateTime.UtcNow.AddMinutes(1),
110115
SigningCredentials = GetSigningCredential(),
111116
@@ -142,3 +147,11 @@ public class ClientAssertionService(IOptionsSnapshot<ClientCredentialsClient> op
142147
}`}/>
143148
</TabItem>
144149
</Tabs>
150+
151+
152+
:::note
153+
You need to explicitly set the `Audience` to the authorization server's issuer URL (usually the URL of identity server).
154+
155+
Don't set the audience to the `TokenUrl`. Setting the `Audience` value to the token endpoint leaves
156+
you vulnerable to these vulnerabilities: (CVE-2025-27370/CVE-2025-27371).
157+
:::

src/content/docs/accesstokenmanagement/advanced/extensibility.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,13 @@ services.AddHttpClient<YourTypedHttpClient>()
8787
.AddDefaultAccessTokenResiliency()
8888
.AddHttpMessageHandler(provider =>
8989
{
90-
var yourCustomTokenRetriever = new CustomTokenRetriever();
90+
var yourCustomTokenRetriever = new CustomTokenRetriever(...);
9191

9292
var logger = provider.GetRequiredService<ILogger<AccessTokenRequestHandler>>();
9393
var dPoPProofService = provider.GetRequiredService<IDPoPProofService>();
9494
var dPoPNonceStore = provider.GetRequiredService<IDPoPNonceStore>();
95-
var accessTokenHandler = new AccessTokenRequestHandler(
95+
96+
return new AccessTokenRequestHandler(
9697
tokenRetriever: yourCustomTokenRetriever,
9798
dPoPNonceStore: dPoPNonceStore,
9899
dPoPProofService: dPoPProofService,

src/content/docs/bff/architecture/multi-frontend.md

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,36 +10,59 @@ sidebar:
1010
variant: tip
1111
---
1212

13-
BFF V4.0 introduces the capability to support multiple BFF Frontends in a single host. This helps to simplify your application landscape by consolidating multiple physical BFF Hosts into a single deployable unit.
13+
BFF V4.0 introduces the capability to support multiple BFF Frontends in a single host. This helps to simplify your
14+
application landscape by consolidating multiple physical BFF Hosts into a single deployable unit.
1415

1516
A single BFF setup consists of:
1617
1. A browser based application, typically built using technology like React, Angular or VueJS. This is typically deployed to a Content Delivery Network (CDN).
1718
2. A BFF host, that will take care of the OpenID Connect login flows.
1819
3. An API surface, exposed and protected by the BFF.
1920

20-
With the BFF Multi-frontend support, you can logically host multiple of these BFF Setups in a single host. The concept of a single frontend (with OpenID Connect configuration, an API surface and a browser based app) is now codified inside the BFF. By using a flexible frontend selection mechanism (using Origins or Paths to distinguish), it's possible to create very flexible setups.
21+
With the BFF Multi-frontend support, you can logically host multiple of these BFF Setups in a single host. The concept
22+
of a single frontend (with OpenID Connect configuration, an API surface and a browser based app) is now codified inside
23+
the BFF. By using a flexible frontend selection mechanism (using Hosts or Paths to distinguish), it's possible to
24+
create very flexible setups.
2125

22-
The BFF dynamically configures the aspnet core authentication pipeline according to recommended practices. For example, when doing Origin based routing, it will configure the cookies using the most secure settings and with the prefix [`__Host`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Set-Cookie).
26+
The BFF dynamically configures the aspnet core authentication pipeline according to recommended practices. For example,
27+
when doing Host based routing, it will configure the cookies using the most secure settings and with the prefix
28+
[`__Host`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Set-Cookie).
2329

24-
Frontends can be added or removed dynamically from the system, without having to restart the system. You can do this via configuration (for example by modifying a configuration file) or programmatically.
30+
Frontends can be added or removed dynamically from the system, without having to restart the system. You can do this
31+
via configuration (for example by modifying a configuration file) or programmatically.
2532

2633
:::note
27-
The Duende BFF V4 library doesn't ship with an abstraction to store or read frontends from a database. It's possible to implement this by creating your own store (based on your requirements), then modify the `FrontendCollection` at run-time.
34+
The Duende BFF V4 library doesn't ship with an abstraction to store or read frontends from a database. It's possible
35+
to implement this by creating your own store (based on your requirements), then modify the `FrontendCollection` at
36+
run-time.
2837
:::
2938

3039
## A Typical Example
3140

32-
Consider an enterprise that hosts multiple browser based applications. Each of these applications is developed by a separate team and as such, has its own deployment schedule.
41+
Consider an enterprise that hosts multiple browser based applications. Each of these applications is developed by a
42+
separate team and as such, has its own deployment schedule.
3343

34-
There are some internal-facing applications that are exclusively used by internal employees. These internal employees are all present in Microsoft Entra ID, so these internal-facing applications should directly authenticate against Microsoft Entra ID. These applications also use several internal APIs, that due to the sensitivity, should not be accessible by external users. However, they also use some of the more common APIs. These apps are only accessible via an internal DNS name, such as `https://app1.internal.example.com`.
44+
There are some internal-facing applications that are exclusively used by internal employees. These internal employees
45+
are all present in Microsoft Entra ID, so these internal-facing applications should directly authenticate against
46+
Microsoft Entra ID. These applications also use several internal APIs, that due to the sensitivity, should not be
47+
accessible by external users. However, they also use some of the more common APIs. These apps are only accessible via
48+
an internal DNS name, such as `https://app1.internal.example.com`.
3549

36-
There are also several public facing applications, that are used directly by customers. These users should be able to log in using their own identity, via providers like Google, Twitter, or others. This authentication process is handled by Duende IdentityServer. There is constant development ongoing on these applications and it's not uncommon for new applications to be introduced. There should be single sign-on across all these public facing applications. They are all available on the same domain name, but use path based routing to distinguish themselves, such as `https://app.example.com/app1`
50+
There are also several public facing applications, that are used directly by customers. These users should be able to
51+
log in using their own identity, via providers like Google, Twitter, or others. This authentication process is handled
52+
by Duende IdentityServer. There is constant development ongoing on these applications and it's not uncommon for new
53+
applications to be introduced. There should be single sign-on across all these public facing applications. They are
54+
all available on the same domain name, but use path based routing to distinguish themselves, such as
55+
`https://app.example.com/app1`
3756

38-
There is also a partner portal. This partner portal can only be accessed by employees of the partners. Each partner should be able to bring their own identity provider. This is implemented using the [Dynamic Providers](/identityserver/ui/login/dynamicproviders.md) feature of Duende IdentityServer.
57+
There is also a partner portal. This partner portal can only be accessed by employees of the partners. Each partner
58+
should be able to bring their own identity provider. This is implemented using the [Dynamic Providers](/identityserver/ui/login/dynamicproviders.md) feature of
59+
Duende IdentityServer.
3960

40-
This setup, with multiple frontends, each having different authentication requirements and different API surfaces, is now supported by the BFF.
61+
This setup, with multiple frontends, each having different authentication requirements and different API surfaces,
62+
is now supported by the BFF.
4163

42-
Each frontend can either rely on the global configuration or override (parts of) this configuration, such as the identity provider or the Client ID and Client Secret to use.
64+
Each frontend can either rely on the global configuration or override (parts of) this configuration, such as the
65+
identity provider or the Client ID and Client Secret to use.
4366

4467
It's also possible to dynamically add or remove frontends, without restarting the BFF host.
4568

@@ -51,7 +74,7 @@ To achieve this, the BFF automatically configures the ASP.NET Core pipeline:
5174

5275
![BFF Multi-Frontend Pipeline](../images/bff_multi_frontend_pipeline.svg)
5376

54-
1. `FrontendSelectionMiddleware` - This middleware performs the frontend selection by seeing which frontend's selection criteria best matches the incoming request route. It's possible to mix both path based routing origin based routing, so the most specific will be selected.
77+
1. `FrontendSelectionMiddleware` - This middleware performs the frontend selection by seeing which frontend's selection criteria best matches the incoming request route. It's possible to mix both path based routing and host based routing, so the most specific will be selected.
5578
2. `PathMappingMiddleware` - If you use path mapping, in the selected frontend, then it will automatically map the frontend's path so none of the subsequent middlewares know (or need to care) about this fact.
5679
3. `OpenIdCallbackMiddleware` - To dynamically perform the OpenID Connect authentication without explicitly adding each frontend as a scheme, we inject a middleware that will handle the OpenID Connect callbacks. This only kicks in for dynamic frontends.
5780
4. Your own applications logic is executed in this part of the pipeline. For example, calling `.UseAuthentication(), .UseRequestLogging()`, etc.

src/content/docs/bff/extensibility/management/back-channel-logout.md

Lines changed: 0 additions & 34 deletions
This file was deleted.
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
title: "BFF Back-Channel Logout Endpoint Extensibility"
3+
date: 2022-12-29T10:22:12+02:00
4+
sidebar:
5+
label: "Back-Channel Logout"
6+
order: 60
7+
redirect_from:
8+
- /bff/v2/extensibility/management/back-channel-logout/
9+
- /bff/v3/extensibility/management/back-channel-logout/
10+
- /identityserver/v5/bff/extensibility/management/back-channel-logout/
11+
- /identityserver/v6/bff/extensibility/management/back-channel-logout/
12+
- /identityserver/v7/bff/extensibility/management/back-channel-logout/
13+
---
14+
15+
import { Aside, Code } from "@astrojs/starlight/components";
16+
import { Tabs, TabItem } from "@astrojs/starlight/components";
17+
18+
The back-channel logout endpoint has several extensibility points organized into two interfaces.
19+
The `IBackchannelLogoutEndpoint` is the top-level abstraction that processes requests to the endpoint.
20+
This service can be used to add custom request processing logic or to change how it validates incoming requests.
21+
When the back-channel logout endpoint receives a valid request, it revokes sessions using the `ISessionRevocationService`.
22+
23+
<Aside type="caution">
24+
In BFF V3, the `IBackchannelLogoutEndpoint` interface is called `IBackchannelLogoutService` instead.
25+
</Aside>
26+
27+
## Request Processing
28+
29+
<Tabs syncKey="bffVersion">
30+
<TabItem label="V4">
31+
You can customize the behavior of the back-channel logout endpoint by implementing the `ProcessRequestAsync` method of the
32+
`IBackchannelLogoutEndpoint` interface. The [default implementation][1] can serve as a starting point for your own implementation.
33+
34+
If you want to extend the default behavior of the back-channel logout endpoint, you can instead add a custom endpoint and
35+
call the original endpoint implementation:
36+
37+
<Code
38+
lang="csharp"
39+
title="Program.cs"
40+
code={`
41+
var bffOptions = app.Services.GetRequiredService<IOptions<BffOptions>>().Value;
42+
43+
app.MapGet(bffOptions.BackChannelLogoutPath, async (HttpContext context, CancellationToken ct) =>
44+
{
45+
// Custom logic before calling the original endpoint implementation
46+
var endpointProcessor = context.RequestServices.GetRequiredService<IBackchannelLogoutEndpoint>();
47+
await endpointProcessor.ProcessRequestAsync(context, ct);
48+
// Custom logic after calling the original endpoint implementation
49+
});
50+
`} />
51+
</TabItem>
52+
<TabItem label="V3">
53+
`ProcessRequestAsync` is the top-level function called in the endpoint service `DefaultBackchannelLogoutService`,
54+
and can be used to add arbitrary logic to the endpoint.
55+
56+
For example, you could take whatever actions you need before normal processing of the request like this:
57+
58+
<Code
59+
lang="csharp"
60+
code={`
61+
public override Task ProcessRequestAsync(HttpContext context, CancellationToken ct)
62+
{
63+
// Custom logic here
64+
65+
return base.ProcessRequestAsync(context);
66+
}
67+
`}/>
68+
</TabItem>
69+
</Tabs>
70+
71+
## Session Revocation
72+
73+
The back-channel logout service will call the registered session revocation service to revoke the user session when
74+
it receives a valid logout token. To customize the revocation process, implement the `ISessionRevocationService`.
75+
76+
[1]: https://github.com/DuendeSoftware/products/tree/releases/bff/4.0.x/bff/src/Bff/Endpoints/Internal/DefaultBackchannelLogoutEndpoint.cs

src/content/docs/bff/extensibility/management/diagnostics.md

Lines changed: 0 additions & 27 deletions
This file was deleted.
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
title: "BFF Diagnostics Endpoint Extensibility"
3+
date: 2022-12-29T10:22:12+02:00
4+
sidebar:
5+
order: 70
6+
label: "Diagnostics"
7+
redirect_from:
8+
- /bff/v2/extensibility/management/diagnostics/
9+
- /bff/v3/extensibility/management/diagnostics/
10+
- /identityserver/v5/bff/extensibility/management/diagnostics/
11+
- /identityserver/v6/bff/extensibility/management/diagnostics/
12+
- /identityserver/v7/bff/extensibility/management/diagnostics/
13+
---
14+
15+
import { Aside, Code } from "@astrojs/starlight/components";
16+
import { Tabs, TabItem } from "@astrojs/starlight/components";
17+
18+
The BFF diagnostics endpoint can be customized by implementing the `IDiagnosticsEndpoint`.
19+
20+
<Aside type="caution">
21+
In BFF V3, the `IDiagnosticsEndpoint` interface is called `IDiagnosticsService` instead.
22+
</Aside>
23+
24+
## Request Processing
25+
26+
<Tabs syncKey="bffVersion">
27+
<TabItem label="V4">
28+
You can customize the behavior of the diagnostics endpoint by implementing the `ProcessRequestAsync` method of the
29+
`IDiagnosticsEndpoint` interface. The [default implementation][1]
30+
can serve as a starting point for your own implementation.
31+
32+
If you want to extend the default behavior of the diagnostics endpoint, you can instead add a custom endpoint and
33+
call the original endpoint implementation:
34+
35+
<Code
36+
lang="csharp"
37+
title="Program.cs"
38+
code={`
39+
var bffOptions = app.Services.GetRequiredService<IOptions<BffOptions>>().Value;
40+
41+
app.MapGet(bffOptions.DiagnosticsPath, async (HttpContext context, CancellationToken ct) =>
42+
{
43+
// Custom logic before calling the original endpoint implementation
44+
var endpointProcessor = context.RequestServices.GetRequiredService<IDiagnosticsEndpoint>();
45+
await endpointProcessor.ProcessRequestAsync(context, ct);
46+
// Custom logic after calling the original endpoint implementation
47+
});
48+
`} />
49+
</TabItem>
50+
<TabItem label="V3">
51+
`ProcessRequestAsync` is the top-level function called in the endpoint service `DefaultDiagnosticsService`,
52+
and can be used to add arbitrary logic to the endpoint.
53+
54+
For example, you could take whatever actions you need before normal processing of the request like this:
55+
56+
<Code
57+
lang="csharp"
58+
code={`
59+
public override Task ProcessRequestAsync(HttpContext context, CancellationToken ct)
60+
{
61+
// Custom logic here
62+
63+
return base.ProcessRequestAsync(context);
64+
}
65+
`}/>
66+
</TabItem>
67+
</Tabs>
68+
69+
[1]: https://github.com/DuendeSoftware/products/tree/releases/bff/4.0.x/bff/src/Bff/Endpoints/Internal/DefaultDiagnosticsEndpoint.cs

0 commit comments

Comments
 (0)