Skip to content

Prepare shared libs#161

Draft
bdb-dd wants to merge 7 commits intoAltinn:mainfrom
bdb-dd:prepare-shared-libs
Draft

Prepare shared libs#161
bdb-dd wants to merge 7 commits intoAltinn:mainfrom
bdb-dd:prepare-shared-libs

Conversation

@bdb-dd
Copy link
Copy Markdown

@bdb-dd bdb-dd commented May 7, 2026

Preparation to consider adding Playwright tests and headless preview

Other changes that can prepare for extracting a shared library for Entra ID and Content Delivery client.

Motivation was mostly to do a concrete analysis and these changes are not verified by hand yet.

bdb-dd added 7 commits May 5, 2026 11:15
- Move frontend and backend applications into `apps/` directory structure
- Add classnames dependency to frontend package.json
- Use PNPM as package manager
- Add Playwright config mirroring astro-kinorge setup (chromium, firefox, webkit, mobile variants)
- Add test scripts: test:e2e, test:e2e:ui, test:e2e:update
- Add devDeps: @playwright/test 1.44.0, @axe-core/playwright ^4.10.0, @types/node ^22.10.7
- Author specs: routes.spec.ts (smoke), accessibility.spec.ts (axe + landmarks + keyboard), functional.spec.ts (title, locale-root, navigation, responsive), visual.spec.ts (snapshots)
- 4 pre-existing axe failures carried forward
- Add packages/umbraco-client with createDeliveryApiClient, mapMedia, getMediaUrl, richTextToHtml, getPlainText helpers and the shared Umbraco delivery-API types.
- Rewire apps/astro-infoportal/src/api/umbraco/client.ts to consume the package.
- Add packages/* to pnpm-workspace.yaml.
- Un-ignore /packages/ in .gitignore (the legacy NuGet rule **/[Pp]ackages/* was hiding this workspace package).
Move the Microsoft Entra ID auth trio and the Azure Blob filesystem composer into a new dotnet/Portals.Umbraco.Shared/ project, consumed by umbraco-infoportal via ProjectReference.

Also rename Adapters/Infoportal.Adapters.Elasticsearch/ → dotnet/Infoportal.Adapters.Elasticsearch/ (groups all in-repo .NET libraries under dotnet/).

Two intentional behavior changes carried over from the original extraction:

- Role mapping is now config-driven: appsettings.json declares MicrosoftEntraId.RoleMappings + DefaultUmbracoGroup. Existing mappings (umbraco-admin → admin, umbraco-editor-startogdrive → editorStarteOgDrive, umbraco-editor-nyheter → editorNyheter) are preserved verbatim.
- AzureBlobFileSystemComposer auto-disables when Umbraco.Storage.AzureBlob.Media.ConnectionString is empty. Altinn's deploy sets this via env var so the gate is satisfied in prod.
Portals.Umbraco.Shared.AzureBlobFileSystemComposer auto-registers when ConnectionString is set, so the explicit AddAzureBlobMediaFileSystem / AddAzureBlobImageSharpCache calls in Program.cs are redundant.
Land the editor-facing preview flow on altinn-infoportal: middleware verifies HMAC-signed preview links, PreviewBanner exits on demand, /api/exit-preview clears the cookie, the umbraco client passes preview through to delivery API calls, and the layouts surface the banner.

Deviation from the original Task 9 deferral: HeadlessPreviewUrlProvider lives in dotnet/Portals.Umbraco.Shared/Composers/ rather than in apps/umbraco-infoportal/Composers/. Per portal-owners' decision, headless preview will land on the second portal soon, so the provider belongs in the shared lib. Kjac.HeadlessPreview 3.0.0 moves to Portals.Umbraco.Shared.csproj as a transitive dep for any future consumer.
Move Options/KeyVaultOptions.cs into Portals.Shared.Configuration and add KeyVaultConfigurationExtensions.AddPortalsKeyVault to encapsulate the DefaultAzureCredential wiring. Program.cs collapses 25+ lines of inline KeyVault setup into one call. The Azure.Extensions.AspNetCore.Configuration.Secrets and Azure.Identity NuGet refs move to Portals.Umbraco.Shared.csproj.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant