Skip to content

Commit 9aced1c

Browse files
committed
Convert to mdx + added v3/v4 specific details
1 parent c013920 commit 9aced1c

File tree

15 files changed

+542
-248
lines changed

15 files changed

+542
-248
lines changed

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

src/content/docs/bff/extensibility/management/index.mdx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ builder.Services.AddTransient<IDiagnosticsEndpoint, DefaultDiagnosticsEndpoint>(
4545
Task ProcessRequestAsync(HttpContext context, CancellationToken ct);
4646
}`}/>
4747

48-
You can customize the behavior of the endpoints either by implementing the appropriate interface.
49-
The [default implementations](https://github.com/DuendeSoftware/products/tree/releases/bff/4.0.0/bff/src/Bff/Endpoints/Internal) can serve as a starting point for your own implementation.
48+
You can customize the behavior of the endpoints by implementing the appropriate interface.
49+
The [default implementations][1] can serve as a starting point for your own implementation.
5050

5151
If you want to extend the default behavior of a management endpoint, you can add a custom endpoint and call the original endpoint implementation:
5252

@@ -90,4 +90,6 @@ builder.Services.AddTransient<IDiagnosticsService, DefaultDiagnosticsService>();
9090

9191
Several of the default endpoint service implementations also define virtual methods that can be overridden to customize their behavior with more granularity.
9292
</TabItem>
93-
</Tabs>
93+
</Tabs>
94+
95+
[1]: https://github.com/DuendeSoftware/products/tree/releases/bff/4.0.x/bff/src/Bff/Endpoints/Internal

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

Lines changed: 0 additions & 34 deletions
This file was deleted.
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
title: "BFF Login Endpoint Extensibility"
3+
date: 2022-12-30 10:55:24
4+
sidebar:
5+
label: "Login"
6+
order: 10
7+
redirect_from:
8+
- /bff/v2/extensibility/management/login/
9+
- /bff/v3/extensibility/management/login/
10+
- /identityserver/v5/bff/extensibility/management/login/
11+
- /identityserver/v6/bff/extensibility/management/login/
12+
- /identityserver/v7/bff/extensibility/management/login/
13+
---
14+
15+
import { Aside, Code } from "@astrojs/starlight/components";
16+
import { Tabs, TabItem } from "@astrojs/starlight/components";
17+
18+
The BFF login endpoint has extensibility points in two interfaces. The `ILoginEndpoint` is the top-level abstraction
19+
that processes requests to the endpoint. This service can be used to add custom request processing logic.
20+
The `IReturnUrlValidator` ensures that the `returnUrl` parameter passed to the login endpoint is safe to use.
21+
22+
<Aside type="caution">
23+
In BFF V3, the `ILoginEndpoint` interface is called `ILoginService` instead.
24+
</Aside>
25+
26+
## Request Processing
27+
28+
<Tabs syncKey="bffVersion">
29+
<TabItem label="V4">
30+
You can customize the behavior of the login endpoint by implementing the `ProcessRequestAsync` method of the
31+
`ILoginEndpoint` interface. The [default implementation][1]
32+
can serve as a starting point for your own implementation.
33+
34+
If you want to extend the default behavior of the login 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.LoginPath, async (HttpContext context, CancellationToken ct) =>
44+
{
45+
// Custom logic before calling the original endpoint implementation
46+
var endpointProcessor = context.RequestServices.GetRequiredService<ILoginEndpoint>();
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 `DefaultLoginService`, and can
54+
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+
## Return URL Validation
72+
73+
To prevent open redirector attacks, the `returnUrl` parameter to the login endpoint must be validated. You can
74+
customize this validation by implementing the `IReturnUrlValidator` interface. The default implementation enforces
75+
that return URLs are local.
76+
77+
[1]: https://github.com/DuendeSoftware/products/tree/releases/bff/4.0.x/bff/src/Bff/Endpoints/Internal/DefaultLoginEndpoint.cs

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

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)