@chill-sharp/ui-core 1.1.12 → 1.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/README.md +103 -103
  2. package/fesm2022/chill-sharp-ui-core.mjs +2446 -2446
  3. package/fesm2022/chill-sharp-ui-core.mjs.map +1 -1
  4. package/lib/lib/chill-form.component.d.ts +1 -1
  5. package/package.json +3 -3
  6. package/service-worker/chill-sharp-service-worker.js +166 -166
  7. package/styles/core-theme.scss +1235 -1235
  8. package/.agents/skills/chillsharp-current-user-preferences/SKILL.md +0 -70
  9. package/.agents/skills/chillsharp-ui-template/SKILL.md +0 -18
  10. package/doc/AIAssistedDevelopment/README.md +0 -185
  11. package/doc/AttachmentModel/README.md +0 -173
  12. package/doc/AuthenticationModel/README.md +0 -213
  13. package/doc/AuthenticationModel/how-to-integreate-auth-minimal-api.md +0 -293
  14. package/doc/ChillSharpClient.md +0 -464
  15. package/doc/ClientGeneration/README.md +0 -172
  16. package/doc/ComplianceGuide/README.md +0 -178
  17. package/doc/Configuration/README.md +0 -94
  18. package/doc/CurrentUserPreferences.md +0 -114
  19. package/doc/DateTimePolicy/README.md +0 -154
  20. package/doc/DateTimeSerialization.md +0 -423
  21. package/doc/Endpoints.md +0 -260
  22. package/doc/HowTo/01-simple-blog-sqlite.md +0 -153
  23. package/doc/HowTo/02-blog-schema-labels.md +0 -140
  24. package/doc/HowTo/03-authentication.md +0 -218
  25. package/doc/HowTo/04-blog-posts-one-to-many.md +0 -194
  26. package/doc/HowTo/05-docker-env-variables.md +0 -274
  27. package/doc/HowTo/06-chunk-transactions-autocomplete.md +0 -196
  28. package/doc/Mcp/ChatGPT.md +0 -291
  29. package/doc/Mcp/README.md +0 -799
  30. package/doc/MenuGuide/README.md +0 -49
  31. package/doc/ModelPreparation.md +0 -255
  32. package/doc/PermissionModel/README.md +0 -277
  33. package/doc/README.md +0 -228
  34. package/doc/ReferenceExistence.md +0 -130
  35. package/doc/RegisterContext.md +0 -217
  36. package/doc/UiCore/CRUD.md +0 -170
  37. package/doc/UiCore/README.md +0 -13
  38. package/doc/ValidationModel/README.md +0 -117
  39. package/doc/it/AIAssistedDevelopment/README.md +0 -185
  40. package/doc/it/AttachmentModel/README.md +0 -173
  41. package/doc/it/AuthenticationModel/README.md +0 -171
  42. package/doc/it/AuthenticationModel/how-to-integreate-auth-minimal-api.md +0 -292
  43. package/doc/it/ChillSharpClient.md +0 -464
  44. package/doc/it/ClientGeneration/README.md +0 -152
  45. package/doc/it/ComplianceGuide/README.md +0 -178
  46. package/doc/it/Configuration/README.md +0 -94
  47. package/doc/it/CurrentUserPreferences.md +0 -114
  48. package/doc/it/DateTimePolicy/README.md +0 -154
  49. package/doc/it/DateTimeSerialization.md +0 -423
  50. package/doc/it/Endpoints.md +0 -260
  51. package/doc/it/HowTo/01-simple-blog-sqlite.md +0 -152
  52. package/doc/it/HowTo/02-blog-schema-labels.md +0 -139
  53. package/doc/it/HowTo/03-authentication.md +0 -221
  54. package/doc/it/HowTo/04-blog-posts-one-to-many.md +0 -193
  55. package/doc/it/HowTo/05-docker-env-variables.md +0 -268
  56. package/doc/it/HowTo/06-chunk-transactions-autocomplete.md +0 -196
  57. package/doc/it/Mcp/ChatGPT.md +0 -291
  58. package/doc/it/Mcp/README.md +0 -799
  59. package/doc/it/MenuGuide/README.md +0 -49
  60. package/doc/it/ModelPreparation.md +0 -254
  61. package/doc/it/PermissionModel/README.md +0 -190
  62. package/doc/it/README.md +0 -172
  63. package/doc/it/ReferenceExistence.md +0 -130
  64. package/doc/it/RegisterContext.md +0 -218
  65. package/doc/it/UiCore/CRUD.md +0 -170
  66. package/doc/it/UiCore/README.md +0 -13
  67. package/doc/it/ValidationModel/README.md +0 -117
  68. package/template-customization/upgrade.ps1.template +0 -342
  69. package/template-customization/upgrade.sh.template +0 -271
@@ -1,293 +0,0 @@
1
- Versione italiana: [Italiano](../it/AuthenticationModel/how-to-integreate-auth-minimal-api.md)
2
-
3
- Sure. Here’s the updated, correct, modern version of the setup using **Microsoft.IdentityModel.JsonWebTokens**, because Microsoft decided the old JWT library needed to be “legacy” for fun.
4
-
5
- This is the clean way to do:
6
-
7
- ✅ Identity user store
8
- ✅ Minimal API login/register
9
- ✅ JWT Bearer tokens
10
- ✅ No cookies
11
- ✅ No UI
12
- ✅ No outdated JwtSecurityTokenHandler
13
-
14
- ---
15
-
16
- # ✅ ASP.NET Core Minimal Identity API + JWT (Modern JsonWebTokenHandler)
17
-
18
- ---
19
-
20
- # ✅ 1. Install Packages
21
-
22
- Run:
23
-
24
- ```bash
25
- dotnet add package Microsoft.AspNetCore.Identity.EntityFrameworkCore
26
- dotnet add package Microsoft.AspNetCore.Authentication.JwtBearer
27
- dotnet add package Microsoft.EntityFrameworkCore.SqlServer
28
- dotnet add package Microsoft.IdentityModel.JsonWebTokens
29
- ```
30
-
31
- No `System.IdentityModel.Tokens.Jwt`. We are enlightened now.
32
-
33
- ---
34
-
35
- # ✅ 2. Create Identity DbContext
36
-
37
- ```csharp
38
- using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
39
- using Microsoft.EntityFrameworkCore;
40
-
41
- public class AppDbContext : IdentityDbContext
42
- {
43
- public AppDbContext(DbContextOptions<AppDbContext> options)
44
- : base(options) { }
45
- }
46
- ```
47
-
48
- ---
49
-
50
- # ✅ 3. Configure Database + IdentityCore
51
-
52
- In `Program.cs`:
53
-
54
- ```csharp
55
- builder.Services.AddDbContext<AppDbContext>(options =>
56
- options.UseSqlServer(builder.Configuration.GetConnectionString("Default")));
57
- ```
58
-
59
- Now add Identity:
60
-
61
- ```csharp
62
- builder.Services.AddIdentityCore<IdentityUser>()
63
- .AddEntityFrameworkStores<AppDbContext>()
64
- .AddDefaultTokenProviders();
65
- ```
66
-
67
- ✅ No UI
68
- ✅ No Razor
69
- ✅ No cookie circus
70
-
71
- ---
72
-
73
- # ✅ 4. Configure JWT Authentication (Bearer)
74
-
75
- Add imports:
76
-
77
- ```csharp
78
- using Microsoft.AspNetCore.Authentication.JwtBearer;
79
- using Microsoft.IdentityModel.Tokens;
80
- using System.Text;
81
- ```
82
-
83
- Then:
84
-
85
- ```csharp
86
- var jwtKey = builder.Configuration["Jwt:Key"]!;
87
- var jwtIssuer = builder.Configuration["Jwt:Issuer"]!;
88
- ```
89
-
90
- Now configure:
91
-
92
- ```csharp
93
- builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
94
- .AddJwtBearer(options =>
95
- {
96
- options.TokenValidationParameters = new TokenValidationParameters
97
- {
98
- ValidateIssuer = true,
99
- ValidIssuer = jwtIssuer,
100
-
101
- ValidateAudience = false,
102
-
103
- ValidateIssuerSigningKey = true,
104
- IssuerSigningKey = new SymmetricSecurityKey(
105
- Encoding.UTF8.GetBytes(jwtKey)),
106
-
107
- ValidateLifetime = true
108
- };
109
- });
110
- ```
111
-
112
- ---
113
-
114
- # ✅ 5. Enable Authorization
115
-
116
- ```csharp
117
- builder.Services.AddAuthorization();
118
- ```
119
-
120
- ---
121
-
122
- # ✅ 6. Add Middleware
123
-
124
- After `var app = builder.Build();`
125
-
126
- ```csharp
127
- app.UseAuthentication();
128
- app.UseAuthorization();
129
- ```
130
-
131
- If you skip this, nothing works and you’ll blame yourself, incorrectly.
132
-
133
- ---
134
-
135
- # ✅ 7. Generate JWT Token (Modern JsonWebTokenHandler)
136
-
137
- Add imports:
138
-
139
- ```csharp
140
- using Microsoft.IdentityModel.JsonWebTokens;
141
- using System.Security.Claims;
142
- ```
143
-
144
- Now define:
145
-
146
- ```csharp
147
- string GenerateJwtToken(IdentityUser user)
148
- {
149
- var claims = new List<Claim>
150
- {
151
- new Claim(JwtRegisteredClaimNames.Sub, user.Id),
152
- new Claim(JwtRegisteredClaimNames.Email, user.Email!)
153
- };
154
-
155
- var key = new SymmetricSecurityKey(
156
- Encoding.UTF8.GetBytes(jwtKey));
157
-
158
- var creds = new SigningCredentials(
159
- key,
160
- SecurityAlgorithms.HmacSha256);
161
-
162
- var tokenDescriptor = new SecurityTokenDescriptor
163
- {
164
- Subject = new ClaimsIdentity(claims),
165
- Expires = DateTime.UtcNow.AddHours(2),
166
- Issuer = jwtIssuer,
167
- SigningCredentials = creds
168
- };
169
-
170
- var handler = new JsonWebTokenHandler();
171
-
172
- return handler.CreateToken(tokenDescriptor);
173
- }
174
- ```
175
-
176
- ✅ This is the replacement for the old JwtSecurityTokenHandler.
177
-
178
- ---
179
-
180
- # ✅ 8. Register Endpoint (Minimal API)
181
-
182
- ```csharp
183
- app.MapPost("/register", async (
184
- UserManager<IdentityUser> userManager,
185
- RegisterRequest request) =>
186
- {
187
- var user = new IdentityUser
188
- {
189
- UserName = request.Email,
190
- Email = request.Email
191
- };
192
-
193
- var result = await userManager.CreateAsync(user, request.Password);
194
-
195
- if (!result.Succeeded)
196
- return Results.BadRequest(result.Errors);
197
-
198
- return Results.Ok("User registered");
199
- });
200
- ```
201
-
202
- ---
203
-
204
- # ✅ 9. Login Endpoint (Returns JWT)
205
-
206
- ```csharp
207
- app.MapPost("/login", async (
208
- UserManager<IdentityUser> userManager,
209
- LoginRequest request) =>
210
- {
211
- var user = await userManager.FindByEmailAsync(request.Email);
212
-
213
- if (user == null)
214
- return Results.Unauthorized();
215
-
216
- var valid = await userManager.CheckPasswordAsync(user, request.Password);
217
-
218
- if (!valid)
219
- return Results.Unauthorized();
220
-
221
- var token = GenerateJwtToken(user);
222
-
223
- return Results.Ok(new { token });
224
- });
225
- ```
226
-
227
- ---
228
-
229
- # ✅ 10. Protect an Endpoint
230
-
231
- ```csharp
232
- app.MapGet("/me", (ClaimsPrincipal user) =>
233
- {
234
- var email = user.FindFirst(ClaimTypes.Email)?.Value;
235
-
236
- return Results.Ok(new { email });
237
- })
238
- .RequireAuthorization();
239
- ```
240
-
241
- ---
242
-
243
- # ✅ 11. Add Request Models
244
-
245
- ```csharp
246
- public record RegisterRequest(string Email, string Password);
247
-
248
- public record LoginRequest(string Email, string Password);
249
- ```
250
-
251
- ---
252
-
253
- # ✅ 12. Configure appsettings.json
254
-
255
- ```json
256
- "Jwt": {
257
- "Key": "REPLACE_WITH_A_REAL_SECRET_32+_CHARS",
258
- "Issuer": "MyApiAuthServer"
259
- }
260
- ```
261
-
262
- Make the key long and random, unless you want attackers logging in as you for sport.
263
-
264
- ---
265
-
266
- # ✅ Result
267
-
268
- Now you have:
269
-
270
- ✅ `/register`
271
- ✅ `/login` → returns JWT
272
- ✅ Protected endpoints with Bearer token
273
- ✅ Identity user store in SQL
274
- ✅ No cookies
275
- ✅ No UI
276
- ✅ No legacy JWT handler
277
-
278
- ---
279
-
280
- # If You Want Next Steps
281
-
282
- The moment you want:
283
-
284
- * Refresh tokens
285
- * Roles + claims
286
- * Password reset endpoints
287
- * Email confirmation
288
- * `/logout` with JWT invalidation (annoying)
289
-
290
- Then authentication becomes a *real* system, not a demo.
291
-
292
- Still, this setup is the clean foundation Microsoft should’ve shipped by default.
293
-