Skip to content

Commit 5d3e3ab

Browse files
committed
BFF - Standardize usage of inline code formatting for options, methods, and configuration references
1 parent 8381281 commit 5d3e3ab

14 files changed

Lines changed: 90 additions & 90 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ builder.Services.AddTransient<IDiagnosticsService, DefaultDiagnosticsService>();
8686
}`}/>
8787

8888
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.
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>

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The token management library does essentially two things:
2121
Both aspects can be customized.
2222

2323
### 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`:
2525

2626
```csharp
2727
builder.Services.AddHttpClient(
@@ -42,8 +42,8 @@ If you do not use server-side sessions, then the access and refresh token will b
4242

4343
This would involve two steps
4444

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
4747

4848
The interface is responsible to storing, retrieving and clearing tokens for the automatic token management:
4949

@@ -88,7 +88,7 @@ public interface IUserTokenStore
8888
```
8989

9090
### 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`.
9292

9393

9494
```csharp
@@ -108,15 +108,15 @@ public interface IAccessTokenRetriever
108108
}
109109
```
110110

111-
You can implement this interface yourself or extend the *DefaultAccessTokenRetriever*.
111+
You can implement this interface yourself or extend the `DefaultAccessTokenRetriever`.
112112

113113
:::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.
115115
:::
116116

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.
118118

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:
120120

121121
```csharp
122122
app.MapRemoteBffApiEndpoint(
@@ -126,4 +126,4 @@ app.MapRemoteBffApiEndpoint(
126126
.WithAccessTokenRetriever<ImpersonationAccessTokenRetriever>();
127127
```
128128

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.
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.

astro/src/content/docs/bff/fundamentals/apis/remote.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ Remote APIs typically require access control and must be protected against threa
8484

8585
To provide access control, you can specify authorization policies on the mapped routes and configure them with access token requirements.
8686

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.
8888

8989
#### SameSite cookies
9090

astro/src/content/docs/bff/fundamentals/apis/yarp.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,13 @@ configuration:
125125
```
126126

127127
Similarly to the [simple HTTP forwarder](/bff/fundamentals/apis/remote.mdx#access-token-requirements), the allowed values
128-
for the token type are *None*, *User*, *Client*, *UserOrClient*, and *UserOrNone*.
128+
for the token type are `None`, `User`, `Client`, `UserOrClient`, and `UserOrNone`.
129129

130-
Routes that set the *Duende.Bff.Yarp.TokenType* metadata **require** the given type of access token. If it is
131-
unavailable (for example, if the *User* token type is specified but the request to the BFF is anonymous), then the
130+
Routes that set the `Duende.Bff.Yarp.TokenType` metadata **require** the given type of access token. If it is
131+
unavailable (for example, if the `User` token type is specified but the request to the BFF is anonymous), then the
132132
proxied request will not be sent, and the BFF will return an HTTP 401: Unauthorized response.
133133

134-
If you are using the code config method, call the *WithAccessToken* extension method to achieve the same thing:
134+
If you are using the code config method, call the `WithAccessToken` extension method to achieve the same thing:
135135

136136
```csharp
137137
yarpBuilder.LoadFromMemory(
@@ -152,16 +152,16 @@ yarpBuilder.LoadFromMemory(
152152
);
153153
```
154154

155-
Again, the *WithAccessToken* method causes the route to require the given type of access token. If it is unavailable,
155+
Again, the `WithAccessToken` method causes the route to require the given type of access token. If it is unavailable,
156156
the proxied request will not be made and the BFF will return an HTTP 401: Unauthorized response.
157157

158158
## Optional User Access Tokens
159159

160-
You can attach user access tokens optionally using the *UserOrNone* token type. This causes the user's access token to
160+
You can attach user access tokens optionally using the `UserOrNone` token type. This causes the user's access token to
161161
be sent with the proxied request when the user is logged in, but makes the request anonymously when the user is not
162162
logged in.
163163

164-
In configuration, set the *Duende.Bff.Yarp.TokenType* metadata to *UserOrNone*:
164+
In configuration, set the `Duende.Bff.Yarp.TokenType` metadata to `UserOrNone`:
165165

166166
```json
167167
{
@@ -181,7 +181,7 @@ In configuration, set the *Duende.Bff.Yarp.TokenType* metadata to *UserOrNone*:
181181
}
182182
```
183183

184-
If you are using the code config method, call the *WithAccessToken* extension method with *RequiredTokenType.UserOrNone*:
184+
If you are using the code config method, call the `WithAccessToken` extension method with `RequiredTokenType.UserOrNone`:
185185

186186
```csharp
187187
yarpBuilder.LoadFromMemory(
@@ -217,7 +217,7 @@ The value of the header is not important, but its presence, combined with the co
217217
preflight request for cross-origin calls. This effectively isolates the caller to the same origin as the backend,
218218
providing a robust security guarantee.
219219

220-
You can add the anti-forgery protection to all YARP routes by calling the *AsBffApiEndpoint* extension method:
220+
You can add the anti-forgery protection to all YARP routes by calling the `AsBffApiEndpoint` extension method:
221221

222222
```csharp
223223
app.MapReverseProxy()
@@ -228,7 +228,7 @@ app.MapBffReverseProxy();
228228
```
229229

230230
If you need more fine-grained control over which routes should enforce the anti-forgery header, you can also annotate
231-
the route configuration by adding the *Duende.Bff.Yarp.AntiforgeryCheck* metadata to the route config:
231+
the route configuration by adding the `Duende.Bff.Yarp.AntiforgeryCheck` metadata to the route config:
232232

233233
```json
234234
{

astro/src/content/docs/bff/fundamentals/blazor/index.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -227,25 +227,25 @@ information from the user, but is also enriched with several management claims,
227227

228228
Blazor uses AuthenticationStateProviders to make authentication state available to components. On the server, the
229229
authentication state is already mostly managed by the authentication framework. However, the BFF will add the Logout url
230-
to the claims using the **AddServerManagementClaimsTransform**. On the client, there are some other claims that might be
231-
useful. The **BffClientAuthenticationStateProvider** will poll the server to update the client on the latest
230+
to the claims using the `AddServerManagementClaimsTransform`. On the client, there are some other claims that might be
231+
useful. The `BffClientAuthenticationStateProvider` will poll the server to update the client on the latest
232232
authentication state, such as the user's claims. This also notifies the front-end if the session is terminated on the
233233
server.
234234

235235
## Server Side Token Store
236236

237237
Blazor Server applications have the same token management requirements as a regular ASP.NET Core web application.
238238
Because Blazor Server streams content to the application over a websocket, there often is no HTTP request or response to
239-
interact with during the execution of a Blazor Server application. You therefore cannot use *HttpContext* in a Blazor
239+
interact with during the execution of a Blazor Server application. You therefore cannot use `HttpContext` in a Blazor
240240
Server application as you would in a traditional ASP.NET Core web application.
241241

242242
This means:
243243

244-
* you cannot use *HttpContext* extension methods
244+
* you cannot use `HttpContext` extension methods
245245
* you can’t use the ASP.NET authentication session to store tokens
246246
* the normal mechanism used to automatically attach tokens to Http Clients making API calls won't work
247247

248-
The **ServerSideTokenStore**, together with the Blazor Server functionality in Duende.AccessTokenManagement is
248+
The `ServerSideTokenStore`, together with the Blazor Server functionality in Duende.AccessTokenManagement is
249249
automatically registered when you register Blazor Server.
250250

251251
For more information on this, see [Blazor Server](/accesstokenmanagement/blazor-server.md)

0 commit comments

Comments
 (0)