docs: replace stale auth UI examples (#387)
Heimdall Gitea / Detect CI scope (pull_request) Successful in 5s
Heimdall Gitea / Build and tests (pull_request) Skipped
Heimdall Gitea / Build and scan server image (pull_request) Skipped
Heimdall Gitea / Build and scan agent image (pull_request) Skipped
Heimdall Gitea / Build and scan NVIDIA Agent image (pull_request) Skipped
Heimdall Gitea / Publish versioned installer release (pull_request) Skipped
Heimdall Gitea / CI policy (pull_request) Successful in 1m4s

This commit is contained in:
arnaud.dartois committed 2026-11-13 11:11:23 +01:00
1 parent 8f3d75680d
commit e01d2e6fbd
2 files changed
+11 -28

No files matched your search

+9 -28
View File
@@ -217,36 +217,17 @@ policy appliquée à ces deux endpoints dans le contrôleur actuel.
}
}
// Page Events — filtrer par site si User non-Admin
@code {
protected override async Task OnInitializedAsync()
{
if (await AuthorizeService.IsAdminAsync())
{
_sites = await SiteService.GetAllAsync();
}
else
{
_sites = await SiteService.GetMySitesAsync();
}
}
}
```
### AuthorizeView
```razor
<AuthorizeView Policy="@AppPermissions.CameraRead">
<Authorized>
<button @onclick="StartLiveView">📷 Live</button>
</Authorized>
<NotAuthorized>
<MudTooltip Text="Accès non autorisé">
<button disabled>📷 Live</button>
</MudTooltip>
</NotAuthorized>
</AuthorizeView>
```
Les pages authentifiées sont enveloppées par `AuthorizeRouteView` dans
[`Routes.razor`](../src/Heimdall.Web/Components/Routes.razor); par exemple,
[`EventsPage.razor`](../src/Heimdall.Web/Components/Pages/EventsPage.razor)
déclare `[Authorize]` et charge les données via `HeimdallApiClient`. Les listes
et détails site/caméra ne filtrent pas les ressources selon un `IsAdminAsync`
local : les endpoints et queries appliquent les permissions puis
[`ResourceAccess`](../src/Heimdall.Web/Security/ResourceAccess.cs) et les
services d’accès aux ressources. Les endpoints de session live et la distinction
`Camera.Read`/`Camera.Live` sont décrits ci-dessus.
---
+2
View File
@@ -11,6 +11,8 @@ When maintaining `docs/auth-roles.md`, verify its role names and default permiss
Verify identity model examples against `Infrastructure/Identity/IdentityAppUser.cs`, `Domain/Entities/UserSite.cs`, and `Infrastructure/Data/Configurations/UserSiteConfiguration.cs`. Keep ASP.NET Identity in Infrastructure; `UserSite` stores the user ID without an Identity navigation, and Infrastructure maps that foreign key.
Before documenting UI/API authorization examples in `docs/auth-roles.md`, verify referenced pages, methods, policies, and routes against `Components/Routes.razor`, the page components, controllers, and `ResourceAccess`. Do not preserve generic authorization snippets that reference services or callbacks absent from the application; distinguish page authentication from API resource filtering.
- Identity owns password hashing, normalized account lookup, role membership, lockout, authenticator tokens, and email/password tokens. Do not duplicate password or token cryptography in Heimdall.
- Keep ASP.NET Core Identity packages and types inside Infrastructure. Domain must not reference Identity; Application uses `IIdentityAccountService` and `IdentityAccount` only. Put Identity EF entities (`IdentityAppUser`, `IdentityAppRole`) and `UserManager`/`RoleManager` adapters in Infrastructure. Keep user-related Domain relationships keyed by `Guid UserId`; configure their foreign keys to the Infrastructure user entity.
- When creating an Identity user, copy the generated `SecurityStamp` back into the application account before building the first session/JWT. Cover bootstrap and regular user creation with a relational session validation test.