Skip to content

Commit 044f992

Browse files
committed
Clarify v4 token retrieval and logout extensibility
1 parent 702816f commit 044f992

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

astro/src/content/docs/bff/extensibility/management/logout.mdx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ The `IReturnUrlValidator` ensures that the `returnUrl` parameter passed to the l
2828
<Tabs syncKey="bffVersion">
2929
<TabItem label="V4">
3030
You can customize the behavior of the logout endpoint by implementing the `ProcessRequestAsync` method of the
31-
`ILogoutEndpoint` interface. The [default implementation][1]
31+
`ILogoutEndpoint` interface. The [default implementation](https://github.com/DuendeSoftware/products/tree/releases/bff/4.0.x/bff/src/Bff/Endpoints/Internal/DefaultLogoutEndpoint.cs)
3232
can serve as a starting point for your own implementation.
3333

3434
If you want to extend the default behavior of the logout endpoint, you can instead add a custom endpoint and
@@ -50,7 +50,7 @@ app.MapGet(bffOptions.LogoutPath, async (HttpContext context, CancellationToken
5050
`} />
5151
</TabItem>
5252
<TabItem label="V3">
53-
`ProcessRequestAsync` is the top-level function called in the endpoint service `DefaultSilentLoginCallbackService`,
53+
`ProcessRequestAsync` is the top-level function called in the endpoint service `DefaultLogoutService`,
5454
and can be used to add arbitrary logic to the endpoint.
5555

5656
For example, you could take whatever actions you need before normal processing of the request like this:
@@ -73,5 +73,3 @@ public override Task ProcessRequestAsync(HttpContext context, CancellationToken
7373
To prevent open redirector attacks, the `returnUrl` parameter to the logout endpoint must be validated. You can
7474
customize this validation by implementing the `IReturnUrlValidator` interface. The default implementation enforces
7575
that return URLs are local.
76-
77-
[1]: https://github.com/DuendeSoftware/products/tree/releases/bff/4.0.x/bff/src/Bff/Endpoints/Internal/DefaultLogoutEndpoint.cs

astro/src/content/docs/bff/extensibility/tokens.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,13 @@ public interface IAccessTokenRetriever
108108
}
109109
```
110110

111-
You can implement this interface yourself or extend the *DefaultAccessTokenRetriever*. The *AccessTokenResult* class represents the result of this operation. It is an abstract class with concrete implementations that represent successfully retrieving a bearer token (*BearerTokenResult*), successfully retrieving a DPoP token (*DPoPTokenResult*), failing to find an optional token (*NoAccessTokenResult*), which is not an error, and failure to retrieve a token (*AccessTokenRetrievalError*). Your implementation of GetAccessTokenAsync should return one of those types.
111+
You can implement this interface yourself or extend the *DefaultAccessTokenRetriever*.
112+
113+
:::note
114+
In Duende BFF v4, *DefaultAccessTokenRetriever* was made `internal`. If you need to customize token retrieval in v4, implement the *IAccessTokenRetriever* interface directly. The default implementation simply calls `context.HttpContext.GetManagedAccessToken()` with the configured token type, so replicating its behavior is straightforward.
115+
:::
116+
117+
The *AccessTokenResult* class represents the result of this operation. It is an abstract class with concrete implementations that represent successfully retrieving a bearer token (*BearerTokenResult*), successfully retrieving a DPoP token (*DPoPTokenResult*), failing to find an optional token (*NoAccessTokenResult*), which is not an error, and failure to retrieve a token (*AccessTokenRetrievalError*). Your implementation of GetAccessTokenAsync should return one of those types.
112118

113119
Implementations of the *IAccessTokenRetriever* can be added to endpoints when they are mapped using the *WithAccessTokenRetriever* extension method:
114120

0 commit comments

Comments
 (0)