You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can customize the behavior of the endpoints either by implementing the appropriate interface or by extending the default implementation of that interface.
89
-
In many cases, extending the default implementation is preferred, as this allows you to keep most of the default behavior by calling the base *ProcessRequestAsync* from your derived class.
89
+
In many cases, extending the default implementation is preferred, as this allows you to keep most of the default behavior by calling the base `ProcessRequestAsync` from your derived class.
90
90
91
91
Several of the default endpoint service implementations also define virtual methods that can be overridden to customize their behavior with more granularity.
Copy file name to clipboardExpand all lines: astro/src/content/docs/bff/extensibility/tokens.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ The token management library does essentially two things:
21
21
Both aspects can be customized.
22
22
23
23
### Token service communication
24
-
The token management library uses a named HTTP client from the HTTP client factory for all token service communication. You can provide a customized HTTP client yourself using the well-known name after calling *AddBff*:
24
+
The token management library uses a named HTTP client from the HTTP client factory for all token service communication. You can provide a customized HTTP client yourself using the well-known name after calling `AddBff`:
25
25
26
26
```csharp
27
27
builder.Services.AddHttpClient(
@@ -42,8 +42,8 @@ If you do not use server-side sessions, then the access and refresh token will b
42
42
43
43
This would involve two steps
44
44
45
-
* turn off the *SaveTokens* flag on the OpenID Connect handler and handle the relevant events manually to store the tokens in your custom store
46
-
* implement and register the *Duende.AccessTokenManagement.IUserTokenStore* interface
45
+
* turn off the `SaveTokens` flag on the OpenID Connect handler and handle the relevant events manually to store the tokens in your custom store
46
+
* implement and register the `Duende.AccessTokenManagement.IUserTokenStore` interface
47
47
48
48
The interface is responsible to storing, retrieving and clearing tokens for the automatic token management:
49
49
@@ -88,7 +88,7 @@ public interface IUserTokenStore
88
88
```
89
89
90
90
### Per-route Customized Token Retrieval
91
-
The token store defines how tokens are retrieved globally. However, you can add custom logic that changes the way that access tokens are retrieved on a per-route basis. For example, you might need to exchange a token to perform delegation or impersonation for some API calls, depending on the remote API. The interface that describes this extension point is the *IAccessTokenRetriever*.
91
+
The token store defines how tokens are retrieved globally. However, you can add custom logic that changes the way that access tokens are retrieved on a per-route basis. For example, you might need to exchange a token to perform delegation or impersonation for some API calls, depending on the remote API. The interface that describes this extension point is the `IAccessTokenRetriever`.
92
92
93
93
94
94
```csharp
@@ -108,15 +108,15 @@ public interface IAccessTokenRetriever
108
108
}
109
109
```
110
110
111
-
You can implement this interface yourself or extend the *DefaultAccessTokenRetriever*.
111
+
You can implement this interface yourself or extend the `DefaultAccessTokenRetriever`.
112
112
113
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.
114
+
In Duende BFF v4, `DefaultAccessTokenRetriever` was made `internal`. If you need to customize token retrieval in v4, implement the `IAccessTokenRetriever` interface directly.
115
115
:::
116
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.
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.
118
118
119
-
Implementations of the *IAccessTokenRetriever* can be added to endpoints when they are mapped using the *WithAccessTokenRetriever* extension method:
119
+
Implementations of the `IAccessTokenRetriever` can be added to endpoints when they are mapped using the `WithAccessTokenRetriever` extension method:
The *GetAccessTokenAsync* method will be invoked on every call to APIs that use the access token retriever. If retrieving the token is an expensive operation, you may need to cache it. It is up to your retriever code to perform caching.
129
+
The `GetAccessTokenAsync` method will be invoked on every call to APIs that use the access token retriever. If retrieving the token is an expensive operation, you may need to cache it. It is up to your retriever code to perform caching.
Copy file name to clipboardExpand all lines: astro/src/content/docs/bff/fundamentals/apis/remote.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -84,7 +84,7 @@ Remote APIs typically require access control and must be protected against threa
84
84
85
85
To provide access control, you can specify authorization policies on the mapped routes and configure them with access token requirements.
86
86
87
-
To defend against CSRF attacks, you should use SameSite cookies to authenticate calls from the frontend to the BFF. As an additional layer of defense, APIs mapped with *MapRemoteBffApiEndpoint* are automatically protected with an anti-forgery header.
87
+
To defend against CSRF attacks, you should use SameSite cookies to authenticate calls from the frontend to the BFF. As an additional layer of defense, APIs mapped with `MapRemoteBffApiEndpoint` are automatically protected with an anti-forgery header.
0 commit comments