Skip to content

Commit 2a3c3c9

Browse files
committed
refactor(documentation): update
1 parent 299416b commit 2a3c3c9

18 files changed

Lines changed: 126 additions & 25 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.20260326-1604
38+
$ dotnet add package SimpleW.Helper.Hosting --version 26.0.0-rc.20260329-1623
3939
```
4040

4141

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

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,43 @@ 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.20260326-1604
28+
$ dotnet add package SimpleW.Helper.Jwt --version 26.0.0-rc.20260329-1623
2929
```
3030

31+
## Configuration options
3132

32-
### Creating a Token
33+
### JwtBearerOptions
34+
35+
| Option | Default | Description |
36+
| ---------------- | ---------- | ---------------------------------------------------------------------------------------- |
37+
| SecretKey* || Secret key used to sign and validate JWT tokens (HMAC). Must be strong and kept private. |
38+
| ExpectedIssuer | `null` | Expected `iss` claim. If set, the token must match this value. |
39+
| ExpectedAudience | `null` | Expected `aud` claim. If set, the token must match this value. |
40+
| ClockSkew | `1 minute` | Allowed clock drift when validating `exp` and `nbf`. |
41+
| Algorithm | `HS256` | HMAC algorithm used to sign tokens (`HS256`, `HS384`, `HS512`). |
42+
43+
### CreateToken options
44+
45+
| Parameter | Default | Description |
46+
| --------------------- | -------------------------- | -------------------------------------------------------------------------------------------- |
47+
| options* || JWT configuration used for signing and default validation-related values. |
48+
| principal / identity* || Source object used to generate the JWT payload. |
49+
| lifetime* || Token validity duration. Used to compute `exp`. |
50+
| issuer | `options.ExpectedIssuer` | Optional issuer written into the `iss` claim. |
51+
| audience | `options.ExpectedAudience` | Optional audience written into the `aud` claim. |
52+
| nowUtc | `DateTimeOffset.UtcNow` | Optional UTC timestamp override used to compute `iat`, `nbf`, and `exp`. Useful for testing. |
53+
54+
### TryValidateToken options
55+
56+
| Parameter | Description |
57+
| --------- | ------------------------------------------------------------------------------------------ |
58+
| options* | JWT configuration used to validate signature, issuer, audience, clock skew, and algorithm. |
59+
| token* | JWT string to validate. Must contain exactly 3 parts. |
60+
| principal | Output principal rebuilt from the token when validation succeeds. |
61+
| error | Output error message when validation fails. |
62+
63+
64+
## Creating a Token
3365

3466
A token is created from an identity.
3567

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.20260326-1604
33+
$ dotnet add package SimpleW.Helper.Razor --version 26.0.0-rc.20260329-1623
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.20260326-1604
23+
$ dotnet add package SimpleW.JsonEngine.Newtonsoft --version 26.0.0-rc.20260329-1623
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.20260326-1604
33+
$ dotnet add package SimpleW.Service.Firewall --version 26.0.0-rc.20260329-1623
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.20260326-1604
29+
$ dotnet add package SimpleW.Service.Latency --version 26.0.0-rc.20260329-1623
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.20260326-1604
32+
$ dotnet add package SimpleW.Service.Letsencrypt --version 26.0.0-rc.20260329-1623
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.20260326-1604
35+
$ dotnet add package SimpleW.Service.OpenID --version 26.0.0-rc.20260329-1623
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.20260326-1604
16+
$ dotnet add package SimpleW --version 26.0.0-rc.20260329-1623
1717
```
1818

1919
::: tip NOTE

documentation/simplew/docs/guide/principal.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -185,15 +185,15 @@ There are **two ways** to define the principal :
185185
```csharp [ConfigurePrincipalResolver]
186186
server.ConfigurePrincipalResolver(session => {
187187

188-
string? token = session.Request.Headers.Authorization;
189-
190-
if (string.IsNullOrWhiteSpace(token)) {
191-
return null;
192-
}
193-
194-
if (!JwtBearerHelper.TryValidateToken(options, token, out HttpPrincipal? principal, out _)) {
195-
return null;
196-
}
188+
var principal = new HttpPrincipal(new HttpIdentity(
189+
isAuthenticated: true,
190+
authenticationType: "Custom",
191+
identifier: "user-123",
192+
name: "John",
193+
email: null,
194+
roles: new[] { "admin" },
195+
properties: null
196+
));
197197

198198
return principal;
199199
});

0 commit comments

Comments
 (0)