Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions src/content/docs/accesstokenmanagement/advanced/user-tokens.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,19 @@ The `UserTokenRequestParameters` class can be used for that:
The request parameters can be passed via the manual API:

```csharp
var token = await _tokenManagementService.GetAccessTokenAsync(User, new UserAccessTokenRequestParameters { ... });
var token = await _tokenManagementService
.GetAccessTokenAsync(User, new UserAccessTokenRequestParameters {
// ...
});
```

...the extension methods

```csharp
var token = await HttpContext.GetUserAccessTokenAsync(
new UserTokenRequestParameters { ... });
new UserTokenRequestParameters {
// ...
});
```

...or the HTTP client factory
Expand All @@ -73,7 +78,9 @@ var token = await HttpContext.GetUserAccessTokenAsync(
// Program.cs
// registers HTTP client that uses the managed user access token
builder.Services.AddUserAccessTokenHttpClient("invoices",
parameters: new UserTokenRequestParameters { ... },
parameters: new UserTokenRequestParameters {
// ...
},
configureClient: client =>
{
client.BaseAddress = new Uri("https://api.company.com/invoices/");
Expand All @@ -84,7 +91,9 @@ builder.Services.AddHttpClient<InvoiceClient>(client =>
{
client.BaseAddress = new Uri("https://api.company.com/invoices/");
})
.AddUserAccessTokenHandler(new UserTokenRequestParameters { ... });
.AddUserAccessTokenHandler(new UserTokenRequestParameters {
// ...
});
```

## Token Storage
Expand Down
5 changes: 3 additions & 2 deletions src/content/docs/bff/extensibility/tokens.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ The token management library uses a named HTTP client from the HTTP client facto
```cs
builder.Services.AddHttpClient(
AccessTokenManagementDefaults.BackChannelHttpClientName,
configureClient => { ... }
);
configureClient => {
// ...
});
```

:::note
Expand Down
13 changes: 9 additions & 4 deletions src/content/docs/bff/fundamentals/apis/local.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,13 @@ Endpoints that require the pre- and post-processing described above must be deco

For Minimal API endpoints, you can apply BFF pre- and post-processing when they are mapped.
```csharp
app.MapPost("/foo", context => { ... })
app.MapPost("/foo", context => {
// ...
})
.RequireAuthorization() // no anonymous access
.AsBffApiEndpoint(); // BFF pre/post processing
```


For MVC controllers, you can similarly apply BFF pre- and post-processing to controller actions when they are mapped.
```csharp
app.MapControllers()
Expand All @@ -124,7 +125,9 @@ Alternatively, you can apply the *[BffApi]* attribute directly to the controller
[Route("myApi")]
[BffApi]
public class MyApiController : ControllerBase
{ ... }
{
// ...
}
```

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

// simple endpoint
app.MapPost("/foo", context => { /* ... */ })
app.MapPost("/foo", context => {
// ...
})
.RequireAuthorization()
// WARNING: Disabling antiforgery protection may make
// your APIs vulnerable to CSRF attacks
Expand Down
8 changes: 6 additions & 2 deletions src/content/docs/bff/fundamentals/session/handlers.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@ builder.Services.AddAuthentication(options =>
options.DefaultChallengeScheme = "oidc";
options.DefaultSignOutScheme = "oidc";
})
.AddCookie("cookie", options => { ... })
.AddOpenIdConnect("oidc", options => { ... });
.AddCookie("cookie", options => {
// ...
})
.AddOpenIdConnect("oidc", options => {
// ...
});
```

## The OpenID Connect Authentication Handler
Expand Down
4 changes: 3 additions & 1 deletion src/content/docs/identityserver/data/ef.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ To enable caching for the EF configuration store implementation, use the `AddCon
```csharp
// Program.cs
builder.Services.AddIdentityServer()
.AddConfigurationStore(options => { ... })
.AddConfigurationStore(options => {
// ...
})
// this is something you will want in production to reduce load on and requests to the DB
.AddConfigurationStoreCache();
```
Expand Down
7 changes: 5 additions & 2 deletions src/content/docs/identityserver/fundamentals/hosting.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@ You add the necessary services to the ASP.NET Core service provider by calling `

```cs
//Program.cs
var idsvrBuilder = builder.Services.AddIdentityServer(options => { ... });
var idsvrBuilder = builder.Services.AddIdentityServer(options =>
{
// ...
});
```

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

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