Skip to content

Commit 16eec51

Browse files
committed
refactor(documentation): update
1 parent 10aec5e commit 16eec51

13 files changed

Lines changed: 28 additions & 29 deletions

File tree

documentation/simplew/docs/addons/helper-hosting.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ It allows you to :
3535
Install the package from NuGet:
3636

3737
```sh
38-
$ dotnet add package SimpleW.Helper.Hosting --version 26.0.0-rc.20260329-1636
38+
$ dotnet add package SimpleW.Helper.Hosting --version 26.0.0-rc.20260402-1644
3939
```
4040

4141

documentation/simplew/docs/addons/helper-jwt.md

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ It allows you to :
2525
Install the package from NuGet:
2626

2727
```sh
28-
$ dotnet add package SimpleW.Helper.Jwt --version 26.0.0-rc.20260329-1636
28+
$ dotnet add package SimpleW.Helper.Jwt --version 26.0.0-rc.20260402-1644
2929
```
3030

3131
## Configuration options
@@ -117,30 +117,29 @@ Using with SimpleW, there is two approaches to resolve the principal at request
117117
```csharp [PrincipalResolver Approach]
118118
server.ConfigurePrincipalResolver(session => {
119119

120-
if (!session.Request.Headers.TryGetValue("Authorization", out var auth) || !auth.StartsWith("Bearer ")) {
121-
return HttpPrincipal.Anonymous;
122-
}
123-
124-
string token = auth.Substring("Bearer ".Length);
120+
string? authorization = session.Request.Headers.Authorization;
125121

126-
if (JwtBearerHelper.TryValidateToken(options, token, out var principal, out _)) {
122+
if (!string.IsNullOrWhiteSpace(authorization)
123+
&& authorization.StartsWith("Bearer ", StringComparison.OrdinalIgnoreCase)
124+
&& JwtBearerHelper.TryValidateToken(options, authorization.Substring(7), out HttpPrincipal? principal, out _)
125+
) {
127126
return principal;
128127
}
129-
128+
130129
return HttpPrincipal.Anonymous;
131130
});
132131
```
133132

134133
```csharp [Middleware Approach]
135134
server.UseMiddleware(async (session, next) => {
136-
if (session.Request.Headers.TryGetValue("Authorization", out var auth)
137-
&& auth.StartsWith("Bearer ")
138-
) {
139-
string token = auth.Substring("Bearer ".Length);
140135

141-
if (JwtBearerHelper.TryValidateToken(options, token, out var principal, out _)) {
142-
session.Principal = principal;
143-
}
136+
string? authorization = session.Request.Headers.Authorization;
137+
138+
if (!string.IsNullOrWhiteSpace(authorization)
139+
&& authorization.StartsWith("Bearer ", StringComparison.OrdinalIgnoreCase)
140+
&& JwtBearerHelper.TryValidateToken(options, auth.Substring("Bearer ".Length), out HttpPrincipal? principal, out _)
141+
) {
142+
session.Principal = principal;
144143
}
145144

146145
await next();

documentation/simplew/docs/addons/helper-razor.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ It allows you to :
3030
## Installation
3131

3232
```sh
33-
$ dotnet add package SimpleW.Helper.Razor --version 26.0.0-rc.20260329-1636
33+
$ dotnet add package SimpleW.Helper.Razor --version 26.0.0-rc.20260402-1644
3434
```
3535

3636

documentation/simplew/docs/addons/jsonengine-newtonsoft.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ For this reason, SimpleW provides an official alternative engine via the `Simple
2020
#### Installation
2121

2222
```sh
23-
$ dotnet add package SimpleW.JsonEngine.Newtonsoft --version 26.0.0-rc.20260329-1636
23+
$ dotnet add package SimpleW.JsonEngine.Newtonsoft --version 26.0.0-rc.20260402-1644
2424
```
2525

2626

documentation/simplew/docs/addons/service-firewall.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Optional dependency if you enable GeoIP country filtering :
3030
## Installation
3131

3232
```sh
33-
$ dotnet add package SimpleW.Service.Firewall --version 26.0.0-rc.20260329-1636
33+
$ dotnet add package SimpleW.Service.Firewall --version 26.0.0-rc.20260402-1644
3434
```
3535

3636

documentation/simplew/docs/addons/service-latency.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ No external dependencies.
2626
## Installation
2727

2828
```sh
29-
$ dotnet add package SimpleW.Service.Latency --version 26.0.0-rc.20260329-1636
29+
$ dotnet add package SimpleW.Service.Latency --version 26.0.0-rc.20260402-1644
3030
```
3131

3232

documentation/simplew/docs/addons/service-letsencrypt.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ It allows you to :
2929
## Installation
3030

3131
```sh
32-
$ dotnet add package SimpleW.Service.Letsencrypt --version 26.0.0-rc.20260329-1636
32+
$ dotnet add package SimpleW.Service.Letsencrypt --version 26.0.0-rc.20260402-1644
3333
```
3434

3535

documentation/simplew/docs/addons/service-openid.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ It allows you to :
3232
## Installation
3333

3434
```sh
35-
$ dotnet add package SimpleW.Service.OpenID --version 26.0.0-rc.20260329-1636
35+
$ dotnet add package SimpleW.Service.OpenID --version 26.0.0-rc.20260402-1644
3636
```
3737

3838

documentation/simplew/docs/guide/getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Stop talking, show me the code !
1313
Using the nuget package, always prefer the last version.
1414

1515
```sh
16-
$ dotnet add package SimpleW --version 26.0.0-rc.20260329-1636
16+
$ dotnet add package SimpleW --version 26.0.0-rc.20260402-1644
1717
```
1818

1919
::: tip NOTE

documentation/simplew/docs/guide/handler.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,9 @@ public void Ping() {
141141

142142
:::
143143

144-
145144
The request is considered handled, no automatic response is sent.
146145

146+
147147
### Synchronous Result
148148

149149
::: code-group

0 commit comments

Comments
 (0)