Skip to content

Commit ae565cc

Browse files
committed
Refactor code snippets in documentation for clarity
Updated code examples across various docs to improve readability by adding consistent formatting and placeholder comments. These changes enhance the overall clarity and maintainability of the documentation.
1 parent 865883f commit ae565cc

File tree

6 files changed

+39
-15
lines changed

6 files changed

+39
-15
lines changed

src/content/docs/accesstokenmanagement/advanced/user-tokens.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,19 @@ The `UserTokenRequestParameters` class can be used for that:
5757
The request parameters can be passed via the manual API:
5858

5959
```csharp
60-
var token = await _tokenManagementService.GetAccessTokenAsync(User, new UserAccessTokenRequestParameters { ... });
60+
var token = await _tokenManagementService
61+
.GetAccessTokenAsync(User, new UserAccessTokenRequestParameters {
62+
// ...
63+
});
6164
```
6265

6366
...the extension methods
6467

6568
```csharp
6669
var token = await HttpContext.GetUserAccessTokenAsync(
67-
new UserTokenRequestParameters { ... });
70+
new UserTokenRequestParameters {
71+
// ...
72+
});
6873
```
6974

7075
...or the HTTP client factory
@@ -73,7 +78,9 @@ var token = await HttpContext.GetUserAccessTokenAsync(
7378
// Program.cs
7479
// registers HTTP client that uses the managed user access token
7580
builder.Services.AddUserAccessTokenHttpClient("invoices",
76-
parameters: new UserTokenRequestParameters { ... },
81+
parameters: new UserTokenRequestParameters {
82+
// ...
83+
},
7784
configureClient: client =>
7885
{
7986
client.BaseAddress = new Uri("https://api.company.com/invoices/");
@@ -84,7 +91,9 @@ builder.Services.AddHttpClient<InvoiceClient>(client =>
8491
{
8592
client.BaseAddress = new Uri("https://api.company.com/invoices/");
8693
})
87-
.AddUserAccessTokenHandler(new UserTokenRequestParameters { ... });
94+
.AddUserAccessTokenHandler(new UserTokenRequestParameters {
95+
// ...
96+
});
8897
```
8998

9099
## Token Storage

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ The token management library uses a named HTTP client from the HTTP client facto
2626
```cs
2727
builder.Services.AddHttpClient(
2828
AccessTokenManagementDefaults.BackChannelHttpClientName,
29-
configureClient => { ... }
30-
);
29+
configureClient => {
30+
// ...
31+
});
3132
```
3233

3334
:::note

src/content/docs/bff/fundamentals/apis/local.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,13 @@ Endpoints that require the pre- and post-processing described above must be deco
106106

107107
For Minimal API endpoints, you can apply BFF pre- and post-processing when they are mapped.
108108
```csharp
109-
app.MapPost("/foo", context => { ... })
109+
app.MapPost("/foo", context => {
110+
// ...
111+
})
110112
.RequireAuthorization() // no anonymous access
111113
.AsBffApiEndpoint(); // BFF pre/post processing
112114
```
113115

114-
115116
For MVC controllers, you can similarly apply BFF pre- and post-processing to controller actions when they are mapped.
116117
```csharp
117118
app.MapControllers()
@@ -124,7 +125,9 @@ Alternatively, you can apply the *[BffApi]* attribute directly to the controller
124125
[Route("myApi")]
125126
[BffApi]
126127
public class MyApiController : ControllerBase
127-
{ ... }
128+
{
129+
// ...
130+
}
128131
```
129132

130133
#### Disabling Anti-forgery Protection
@@ -144,7 +147,9 @@ app.MapControllers()
144147
.AsBffApiEndpoint(requireAntiforgeryCheck: false);
145148

146149
// simple endpoint
147-
app.MapPost("/foo", context => { /* ... */ })
150+
app.MapPost("/foo", context => {
151+
// ...
152+
})
148153
.RequireAuthorization()
149154
// WARNING: Disabling antiforgery protection may make
150155
// your APIs vulnerable to CSRF attacks

src/content/docs/bff/fundamentals/session/handlers.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,12 @@ builder.Services.AddAuthentication(options =>
2828
options.DefaultChallengeScheme = "oidc";
2929
options.DefaultSignOutScheme = "oidc";
3030
})
31-
.AddCookie("cookie", options => { ... })
32-
.AddOpenIdConnect("oidc", options => { ... });
31+
.AddCookie("cookie", options => {
32+
// ...
33+
})
34+
.AddOpenIdConnect("oidc", options => {
35+
// ...
36+
});
3337
```
3438

3539
## The OpenID Connect Authentication Handler

src/content/docs/identityserver/data/ef.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ To enable caching for the EF configuration store implementation, use the `AddCon
7878
```csharp
7979
// Program.cs
8080
builder.Services.AddIdentityServer()
81-
.AddConfigurationStore(options => { ... })
81+
.AddConfigurationStore(options => {
82+
// ...
83+
})
8284
// this is something you will want in production to reduce load on and requests to the DB
8385
.AddConfigurationStoreCache();
8486
```

src/content/docs/identityserver/fundamentals/hosting.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,14 @@ You add the necessary services to the ASP.NET Core service provider by calling `
2323

2424
```cs
2525
//Program.cs
26-
var idsvrBuilder = builder.Services.AddIdentityServer(options => { ... });
26+
var idsvrBuilder = builder.Services.AddIdentityServer(options =>
27+
{
28+
// ...
29+
});
2730
```
2831

2932
Many of the fundamental configuration settings can be set on the options. See the
30-
`[IdentityServerOptions](/identityserver/reference/options)` reference for more details.
33+
[`IdentityServerOptions`](/identityserver/reference/options) reference for more details.
3134

3235
The builder object has a number of extension methods to add additional services to the ASP.NET Core service provider.
3336
You can see the full list in the [reference](/identityserver/reference/di) section, but very commonly you start by

0 commit comments

Comments
 (0)