Skip to content

Commit 54594d1

Browse files
committed
Fix formatting
1 parent 89802ed commit 54594d1

File tree

8 files changed

+158
-158
lines changed

8 files changed

+158
-158
lines changed

src/content/docs/accesstokenmanagement/advanced/client-credentials.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ You can add token client definitions to your host while configuring the DotNet s
5555
client.Resource = "urn:invoices";
5656
});`}/>
5757
</TabItem>
58-
</Tabs>
58+
</Tabs>
59+
5960
You can set the following options:
6061

6162
* `TokenEndpoint` - URL of the OAuth token endpoint where this token client requests tokens from

src/content/docs/bff/extensibility/management/diagnostics.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,5 @@ For example, you could take whatever actions you need before normal processing o
2323
public Task ProcessRequestAsync(HttpContext context, CancellationToken ct)
2424
{
2525
// Custom logic here
26-
2726
}
2827
```

src/content/docs/bff/extensibility/management/user.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ There are several ways how you can enrich the claims for a specific user.
3434
The most robust way would be to implement a custom `IClaimsTransformation`.
3535

3636
```csharp
37-
3837
services.AddScoped<IClaimsTransformation, CustomClaimsTransformer>();
3938

4039
public class CustomClaimsTransformer : IClaimsTransformation

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,23 +111,23 @@ In Duende.BFF version 3, use the `MapRemoteBffApiEndpoint` method with the `Requ
111111

112112
Remote APIs sometimes allow anonymous access, but usually require an access token, and the type of access token (user or client) will vary as well. You can specify access token requirements via the `WithAccessToken` extension method. Its `RequiredTokenType` parameter has three options:
113113

114-
* `None`
114+
* **`None`**
115115

116116
No token is required.
117117

118-
* `User`
118+
* **`User`**
119119

120120
A valid user access token is required and will be forwarded to the remote API. A user access token is an access token obtained during an OIDC flow (or subsequent refresh), and is associated with a particular user. User tokens are obtained when the user initially logs in, and will be automatically refreshed using a refresh token when they expire.
121121

122-
* `Client`
122+
* **`Client`**
123123

124124
A valid client access token is required and will be forwarded to the remote API. A client access token is an access token obtained through the client credentials flow, and is associated with the client application, not any particular user. Client tokens can be obtained even if the user is not logged in.
125125

126-
* `UserOrClient`
126+
* **`UserOrClient`**
127127

128128
Either a valid user access token or a valid client access token (as fallback) is required and will be forwarded to the remote API.
129129

130-
* `UserOrNone`
130+
* **`UserOrNone`**
131131

132132
A valid user access token will be forwarded to the remote API when logged in. No access token will be sent when not logged in, and no OIDC flow is challenged to get an access token.
133133

src/content/docs/bff/fundamentals/multi-frontend/index.mdx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ frontends.Remove(name);
140140
A frontend can define its own API surface, by specifying remote APIs.
141141

142142
```csharp
143-
144143
var frontend = new BffFrontend(BffFrontendName.Parse("frontend1"))
145144
.WithRemoteApis(
146145
// map the local path /path to the remote api
@@ -161,7 +160,6 @@ See the topic on [Token Management](../tokens.md) for more information about the
161160
When deploying a multi-frontend BFF, it makes most sense to have the frontend's configured with an `index.html` file that is retrieved from a Content Delivery Network (CDN).
162161

163162
```csharp
164-
165163
var frontend = new BffFrontend(BffFrontendName.Parse("frontend1"))
166164
.WithIndexHtml(new Uri("https://my_cdn/some_app/index.html"))
167165
```

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ A call `BffBuilder.ConfigureOpenIdConnect()` will make sure that:
3232
Below is an example on how to configure the BFF's authentication pipeline.
3333

3434
```csharp
35-
3635
services.AddBff()
3736
.ConfigureOpenIdConnect(options =>
3837
{

src/content/docs/bff/getting-started/multi-frontend.mdx

Lines changed: 76 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ Multi-frontend support is available in Duende.BFF v4 and later. The v3-style of
2626

2727
### 1. Create A New ASP.NET Core Project
2828

29-
```sh
29+
```bash title="Terminal"
3030
dotnet new web -n MyMultiBffApp
3131
cd MyMultiBffApp
3232
```
3333

3434
### 2. Add The Duende.BFF NuGet Package
3535

36-
```sh
36+
```bash title="Terminal"
3737
dotnet add package Duende.BFF
3838
```
3939

@@ -42,50 +42,51 @@ dotnet add package Duende.BFF
4242
Configure OpenID Connect authentication for your BFF host. This is similar to the single frontend setup, but applies to all frontends unless overridden per frontend.
4343

4444
```csharp
45-
builder.Services.AddBff()
46-
.ConfigureOpenIdConnect(options =>
47-
{
48-
options.Authority = "https://demo.duendesoftware.com";
49-
options.ClientId = "interactive.confidential";
50-
options.ClientSecret = "secret";
51-
options.ResponseType = "code";
52-
options.ResponseMode = "query";
53-
54-
options.GetClaimsFromUserInfoEndpoint = true;
55-
options.SaveTokens = true;
56-
options.MapInboundClaims = false;
57-
58-
options.Scope.Clear();
59-
options.Scope.Add("openid");
60-
options.Scope.Add("profile");
61-
62-
// Add this scope if you want to receive refresh tokens
63-
options.Scope.Add("offline_access");
64-
})
65-
.ConfigureCookies(options =>
66-
{
67-
// Because we use an identity server that's configured on a different site
68-
// (duendesoftware.com vs localhost), we need to configure the SameSite property to Lax.
69-
// Setting it to Strict would cause the authentication cookie not to be sent after logging in.
70-
// The user would have to refresh the page to get the cookie.
71-
// Recommendation: Set it to 'strict' if your IDP is on the same site as your BFF.
72-
options.Cookie.SameSite = SameSiteMode.Lax;
73-
});
74-
75-
builder.Services.AddAuthorization();
76-
77-
var app = builder.Build();
78-
79-
app.UseAuthentication();
80-
app.UseRouting();
81-
82-
// adds antiforgery protection for local APIs
83-
app.UseBff();
84-
85-
// adds authorization for local and remote API endpoints
86-
app.UseAuthorization();
87-
88-
app.Run();
45+
// Program.cs
46+
builder.Services.AddBff()
47+
.ConfigureOpenIdConnect(options =>
48+
{
49+
options.Authority = "https://demo.duendesoftware.com";
50+
options.ClientId = "interactive.confidential";
51+
options.ClientSecret = "secret";
52+
options.ResponseType = "code";
53+
options.ResponseMode = "query";
54+
55+
options.GetClaimsFromUserInfoEndpoint = true;
56+
options.SaveTokens = true;
57+
options.MapInboundClaims = false;
58+
59+
options.Scope.Clear();
60+
options.Scope.Add("openid");
61+
options.Scope.Add("profile");
62+
63+
// Add this scope if you want to receive refresh tokens
64+
options.Scope.Add("offline_access");
65+
})
66+
.ConfigureCookies(options =>
67+
{
68+
// Because we use an identity server that's configured on a different site
69+
// (duendesoftware.com vs localhost), we need to configure the SameSite property to Lax.
70+
// Setting it to Strict would cause the authentication cookie not to be sent after logging in.
71+
// The user would have to refresh the page to get the cookie.
72+
// Recommendation: Set it to 'strict' if your IDP is on the same site as your BFF.
73+
options.Cookie.SameSite = SameSiteMode.Lax;
74+
});
75+
76+
builder.Services.AddAuthorization();
77+
78+
var app = builder.Build();
79+
80+
app.UseAuthentication();
81+
app.UseRouting();
82+
83+
// adds antiforgery protection for local APIs
84+
app.UseBff();
85+
86+
// adds authorization for local and remote API endpoints
87+
app.UseAuthorization();
88+
89+
app.Run();
8990
```
9091
### 4. Configure BFF In `Program.cs`
9192

@@ -94,30 +95,31 @@ Configure OpenID Connect authentication for your BFF host. This is similar to th
9495
{/* prettier-ignore */}
9596
<TabItem label="Static">
9697

97-
Register multiple frontends directly in code using `AddFrontends`:
98+
Register multiple frontends directly in code using `AddFrontends`:
9899

99-
```csharp
100-
builder.Services.AddBff()
101-
.AddFrontends(
102-
new BffFrontend(BffFrontendName.Parse("default-frontend"))
103-
.WithIndexHtmlUrl(new Uri("https://localhost:5005/static/index.html")),
104-
new BffFrontend(BffFrontendName.Parse("admin-frontend"))
105-
.WithIndexHtmlUrl(new Uri("https://localhost:5005/admin/index.html"))
106-
);
107-
108-
// ...existing code for authentication, authorization, etc.
109-
```
100+
<Code
101+
lang="csharp"
102+
title="Program.cs"
103+
code={`builder.Services.AddBff()
104+
.AddFrontends(
105+
new BffFrontend(BffFrontendName.Parse("default-frontend"))
106+
.WithIndexHtmlUrl(new Uri("https://localhost:5005/static/index.html")),
107+
new BffFrontend(BffFrontendName.Parse("admin-frontend"))
108+
.WithIndexHtmlUrl(new Uri("https://localhost:5005/admin/index.html"))
109+
);
110+
111+
// ...existing code for authentication, authorization, etc.`}/>
110112

111113
</TabItem>
112114
{/* prettier-ignore */}
113115
<TabItem label="From Config">
116+
You can also load frontend configuration from an `IConfiguration` source, such as a JSON file:
114117

115-
You can also load frontend configuration from an `IConfiguration` source, such as a JSON file:
116-
117-
Example `bffconfig.json`:
118+
Example `bffconfig.json`:
118119

119-
```json
120-
{
120+
<Code
121+
lang="json"
122+
code={`{
121123
"defaultOidcSettings": null,
122124
"defaultCookieSettings": null,
123125
"frontends": {
@@ -136,21 +138,21 @@ Configure OpenID Connect authentication for your BFF host. This is similar to th
136138
]
137139
}
138140
}
139-
}
140-
```
141+
}`}/>
141142

142143
Load and use the configuration in `Program.cs`:
143144

144-
```csharp
145-
var bffConfig = new ConfigurationBuilder()
146-
.AddJsonFile("bffconfig.json")
147-
.Build();
145+
<Code
146+
lang="csharp"
147+
title="Program.cs"
148+
code={`var bffConfig = new ConfigurationBuilder()
149+
.AddJsonFile("bffconfig.json")
150+
.Build();
148151
149-
builder.Services.AddBff()
150-
.LoadConfiguration(bffConfig);
152+
builder.Services.AddBff()
153+
.LoadConfiguration(bffConfig);
151154
152-
// ...existing code for authentication, authorization, etc.
153-
```
155+
// ...existing code for authentication, authorization, etc.`}/>
154156

155157
</TabItem>
156158
</Tabs>
@@ -167,6 +169,7 @@ You can configure remote API proxying in two ways:
167169
You can configure remote APIs for each frontend individually:
168170

169171
```csharp
172+
// Program.cs
170173
builder.Services.AddBff()
171174
.AddFrontends(
172175
new BffFrontend(BffFrontendName.Parse("default-frontend"))

0 commit comments

Comments
 (0)