Updated Keycloak samples#1738
Open
alistairmatthews wants to merge 31 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a Keycloak-backed authentication sample set, including a new TypeScript AppHost + Python API + React frontend sample, plus a refreshed .NET Keycloak sample and supporting agent/skill reference docs.
Changes:
- Introduces
samples/KeycloakTypeScript/KeycloakSamplewith an Aspire TypeScript AppHost orchestrating Keycloak, a FastAPI service, and a Vite/React SPA using OIDC. - Adds/updates
samples/Keycloak(.NET) solution/projects to demonstrate Keycloak auth across API + Blazor SSR + Razor Pages. - Adds project-local agent skill documentation and reference materials; minor solution cleanup in
samples/DatabaseContainers.
Reviewed changes
Copilot reviewed 84 out of 195 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| samples/KeycloakTypeScript/KeycloakSample/tsconfig.apphost.json | TS compiler config for the TypeScript AppHost build output. |
| samples/KeycloakTypeScript/KeycloakSample/realms/AspireKeycloakSample.json | Keycloak realm import template for the TS/Python/React sample. |
| samples/KeycloakTypeScript/KeycloakSample/package.json | Root Node package/scripts for running/linting/building the TS AppHost. |
| samples/KeycloakTypeScript/KeycloakSample/frontend/vite.config.ts | Vite dev server proxy + build-time injection of Keycloak settings. |
| samples/KeycloakTypeScript/KeycloakSample/frontend/tsconfig.node.json | TypeScript config for Vite config/build tooling. |
| samples/KeycloakTypeScript/KeycloakSample/frontend/tsconfig.json | TS project references (app + node configs). |
| samples/KeycloakTypeScript/KeycloakSample/frontend/tsconfig.app.json | TypeScript config for the React app source. |
| samples/KeycloakTypeScript/KeycloakSample/frontend/src/vite-env.d.ts | Global type declarations for injected Keycloak constants. |
| samples/KeycloakTypeScript/KeycloakSample/frontend/src/main.tsx | React bootstrapping with react-oidc-context provider. |
| samples/KeycloakTypeScript/KeycloakSample/frontend/src/index.css | Base/reset styling for the React UI. |
| samples/KeycloakTypeScript/KeycloakSample/frontend/src/auth.ts | OIDC client configuration + user manager factory. |
| samples/KeycloakTypeScript/KeycloakSample/frontend/src/App.tsx | React UI: sign-in/out + authenticated API call and display. |
| samples/KeycloakTypeScript/KeycloakSample/frontend/public/github.svg | Static asset used by the React UI footer link. |
| samples/KeycloakTypeScript/KeycloakSample/frontend/package.json | Frontend dependencies/scripts (Vite/React/OIDC). |
| samples/KeycloakTypeScript/KeycloakSample/frontend/index.html | Vite HTML entrypoint. |
| samples/KeycloakTypeScript/KeycloakSample/frontend/eslint.config.js | Frontend ESLint flat-config for TS/React. |
| samples/KeycloakTypeScript/KeycloakSample/frontend/.gitignore | Frontend-local ignore rules. |
| samples/KeycloakTypeScript/KeycloakSample/frontend/.dockerignore | Frontend Docker context minimization. |
| samples/KeycloakTypeScript/KeycloakSample/eslint.config.mjs | ESLint config for the TS AppHost file. |
| samples/KeycloakTypeScript/KeycloakSample/aspire.config.json | Aspire configuration pointing to the TS AppHost + package versions. |
| samples/KeycloakTypeScript/KeycloakSample/apphost.mts | TS AppHost defining Keycloak, FastAPI app, Vite app, and publish wiring. |
| samples/KeycloakTypeScript/KeycloakSample/app/telemetry.py | OpenTelemetry setup for the FastAPI service. |
| samples/KeycloakTypeScript/KeycloakSample/app/pyproject.toml | Python project metadata and dependencies (FastAPI, OTel, JWT). |
| samples/KeycloakTypeScript/KeycloakSample/app/main.py | FastAPI service with JWT validation against Keycloak + static file hosting. |
| samples/KeycloakTypeScript/KeycloakSample/app/.python-version | Pins Python version for local dev tooling. |
| samples/KeycloakTypeScript/KeycloakSample/app/.dockerignore | Python Docker context minimization. |
| samples/KeycloakTypeScript/KeycloakSample/.vscode/extensions.json | Recommends the Aspire VS Code extension for the sample. |
| samples/KeycloakTypeScript/KeycloakSample/.gitignore | Sample-level ignores for Node/Python/Aspire generated artifacts. |
| samples/KeycloakTypeScript/KeycloakSample/.agents/skills/aspire/references/aspire-13-3-breaking-changes.md | Agent reference: Aspire 13.3 breaking changes checklist. |
| samples/KeycloakTypeScript/KeycloakSample/.agents/skills/aspire/SKILL.md | Project-local top-level Aspire agent routing skill definition. |
| samples/KeycloakTypeScript/KeycloakSample/.agents/skills/aspire-orchestration/references/resource-management.md | Agent reference: resource-scoped operations (aspire wait, aspire resource). |
| samples/KeycloakTypeScript/KeycloakSample/.agents/skills/aspire-orchestration/references/detection.md | Agent reference: how to detect Aspire projects and AppHosts. |
| samples/KeycloakTypeScript/KeycloakSample/.agents/skills/aspire-orchestration/references/app-commands.md | Agent reference: app lifecycle commands and best practices. |
| samples/KeycloakTypeScript/KeycloakSample/.agents/skills/aspire-orchestration/references/agent-workflows.md | Agent reference: workflows for investigations and safe orchestration. |
| samples/KeycloakTypeScript/KeycloakSample/.agents/skills/aspire-monitoring/references/playwright-handoff.md | Agent reference: discovering URLs then handing off to Playwright. |
| samples/KeycloakTypeScript/KeycloakSample/.agents/skills/aspire-monitoring/references/monitoring.md | Agent reference: logs/traces/describe/export usage patterns. |
| samples/KeycloakTypeScript/KeycloakSample/.agents/skills/aspire-init/references/templates.md | Agent reference: aspire new template catalog and usage. |
| samples/KeycloakTypeScript/KeycloakSample/.agents/skills/aspire-init/references/init-workflow.md | Agent reference: aspire init workflow and failure modes. |
| samples/KeycloakTypeScript/KeycloakSample/.agents/skills/aspire-init/SKILL.md | Project-local skill for adding Aspire skeletons to repos. |
| samples/KeycloakTypeScript/KeycloakSample/.agents/skills/aspire-deployment/references/preflight.md | Agent reference: deployment preflight checklist. |
| samples/KeycloakTypeScript/KeycloakSample/.agents/skills/aspire-deployment/references/javascript.md | Agent reference: JavaScript app deployment models in Aspire. |
| samples/KeycloakTypeScript/KeycloakSample/.agents/skills/aspire-deployment/references/github-actions-azure-typescript.yml | Reference GH Actions workflow for TS AppHost Azure deploy. |
| samples/KeycloakTypeScript/KeycloakSample/.agents/skills/aspire-deployment/references/github-actions-azure-csharp.yml | Reference GH Actions workflow for C# AppHost Azure deploy. |
| samples/KeycloakTypeScript/KeycloakSample/.agents/skills/aspire-deployment/references/docker-compose.md | Agent reference: Docker Compose publishing/deployment guidance. |
| samples/KeycloakTypeScript/KeycloakSample/.agents/skills/aspire-deployment/references/aws.md | Agent reference: AWS deployment caveats and workflow. |
| samples/Keycloak/global.json | Pins .NET SDK version for the .NET Keycloak sample. |
| samples/Keycloak/aspire.config.json | Points Aspire CLI to the C# AppHost project for the .NET Keycloak sample. |
| samples/Keycloak/Keycloak.sln | Solution file for the .NET Keycloak sample set. |
| samples/Keycloak/Keycloak.Web.RazorPages/wwwroot/lib/jquery/LICENSE.txt | Third-party license file for Razor Pages static lib. |
| samples/Keycloak/Keycloak.Web.RazorPages/wwwroot/lib/jquery-validation/LICENSE.md | Third-party license file for Razor Pages static lib. |
| samples/Keycloak/Keycloak.Web.RazorPages/wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js | Third-party JS asset for Razor Pages template behavior. |
| samples/Keycloak/Keycloak.Web.RazorPages/wwwroot/lib/jquery-validation-unobtrusive/LICENSE.txt | Third-party license file for Razor Pages static lib. |
| samples/Keycloak/Keycloak.Web.RazorPages/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.rtl.min.css | Third-party CSS asset for Razor Pages template. |
| samples/Keycloak/Keycloak.Web.RazorPages/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.min.css | Third-party CSS asset for Razor Pages template. |
| samples/Keycloak/Keycloak.Web.RazorPages/wwwroot/lib/bootstrap/LICENSE | Third-party license file for Razor Pages static lib. |
| samples/Keycloak/Keycloak.Web.RazorPages/wwwroot/js/site.js | Razor Pages default JS scaffold. |
| samples/Keycloak/Keycloak.Web.RazorPages/wwwroot/css/site.css | Razor Pages default CSS scaffold. |
| samples/Keycloak/Keycloak.Web.RazorPages/appsettings.json | Razor Pages auth/settings base config. |
| samples/Keycloak/Keycloak.Web.RazorPages/appsettings.Development.json | Razor Pages dev overrides (e.g., HTTPS metadata). |
| samples/Keycloak/Keycloak.Web.RazorPages/Properties/launchSettings.json | Razor Pages launch profiles/ports. |
| samples/Keycloak/Keycloak.Web.RazorPages/Program.cs | Razor Pages app startup, Keycloak OIDC config, API client wiring. |
| samples/Keycloak/Keycloak.Web.RazorPages/Pages/_ViewStart.cshtml | Razor Pages layout hookup. |
| samples/Keycloak/Keycloak.Web.RazorPages/Pages/_ViewImports.cshtml | Razor Pages usings/tag helpers. |
| samples/Keycloak/Keycloak.Web.RazorPages/Pages/Weather.cshtml.cs | Weather page code-behind calling Weather API client. |
| samples/Keycloak/Keycloak.Web.RazorPages/Pages/Weather.cshtml | Weather page UI. |
| samples/Keycloak/Keycloak.Web.RazorPages/Pages/Shared/_ValidationScriptsPartial.cshtml | Razor Pages validation scripts partial. |
| samples/Keycloak/Keycloak.Web.RazorPages/Pages/Shared/_LoginPartial.cshtml | Razor Pages login/logout UI and return URL logic. |
| samples/Keycloak/Keycloak.Web.RazorPages/Pages/Shared/_Layout.cshtml.css | Layout CSS. |
| samples/Keycloak/Keycloak.Web.RazorPages/Pages/Shared/_Layout.cshtml | Layout HTML and nav items. |
| samples/Keycloak/Keycloak.Web.RazorPages/Pages/Privacy.cshtml.cs | Privacy page model. |
| samples/Keycloak/Keycloak.Web.RazorPages/Pages/Privacy.cshtml | Privacy page UI. |
| samples/Keycloak/Keycloak.Web.RazorPages/Pages/Logout.cshtml.cs | Logout handler page model. |
| samples/Keycloak/Keycloak.Web.RazorPages/Pages/Logout.cshtml | Logout page scaffold. |
| samples/Keycloak/Keycloak.Web.RazorPages/Pages/Login.cshtml.cs | Login handler page model and helper for login URL. |
| samples/Keycloak/Keycloak.Web.RazorPages/Pages/Login.cshtml | Login page scaffold. |
| samples/Keycloak/Keycloak.Web.RazorPages/Pages/Index.cshtml.cs | Index page model. |
| samples/Keycloak/Keycloak.Web.RazorPages/Pages/Index.cshtml | Index page UI. |
| samples/Keycloak/Keycloak.Web.RazorPages/Pages/Error.cshtml.cs | Error page model. |
| samples/Keycloak/Keycloak.Web.RazorPages/Pages/Error.cshtml | Error page UI. |
| samples/Keycloak/Keycloak.Web.RazorPages/Pages/AuthRequired.cshtml.cs | Authorized page model showing user claim-derived details. |
| samples/Keycloak/Keycloak.Web.RazorPages/Pages/AuthRequired.cshtml | Authorized page UI showing user details. |
| samples/Keycloak/Keycloak.Web.RazorPages/Keycloak.Web.RazorPages.csproj | Razor Pages project file and references. |
| samples/Keycloak/Keycloak.Web.BlazorSSR/wwwroot/app.css | Blazor SSR static styles. |
| samples/Keycloak/Keycloak.Web.BlazorSSR/appsettings.json | Blazor SSR auth/settings base config. |
| samples/Keycloak/Keycloak.Web.BlazorSSR/appsettings.Development.json | Blazor SSR dev overrides (e.g., HTTPS metadata). |
| samples/Keycloak/Keycloak.Web.BlazorSSR/WeatherApiClient.cs | Typed client + MSAL token acquisition for server-to-server calls. |
| samples/Keycloak/Keycloak.Web.BlazorSSR/Properties/launchSettings.json | Blazor SSR launch profiles/ports. |
| samples/Keycloak/Keycloak.Web.BlazorSSR/Program.cs | Blazor SSR startup, Keycloak OIDC config, API client wiring. |
| samples/Keycloak/Keycloak.Web.BlazorSSR/NavigationManagerExtensions.cs | Helper to prevent open redirects by forcing relative URLs. |
| samples/Keycloak/Keycloak.Web.BlazorSSR/Keycloak.Web.BlazorSSR.csproj | Blazor SSR project file and references. |
| samples/Keycloak/Keycloak.Web.BlazorSSR/Components/_Imports.razor | Shared Razor component imports/usings. |
| samples/Keycloak/Keycloak.Web.BlazorSSR/Components/Routes.razor | Router configuration. |
| samples/Keycloak/Keycloak.Web.BlazorSSR/Components/Pages/Weather.razor | Weather page calling the Weather API client. |
| samples/Keycloak/Keycloak.Web.BlazorSSR/Components/Pages/Logout.razor | Logout endpoint presence for form post wiring. |
| samples/Keycloak/Keycloak.Web.BlazorSSR/Components/Pages/Login.razor | Login redirect page and helper for login URL. |
| samples/Keycloak/Keycloak.Web.BlazorSSR/Components/Pages/Home.razor | Home page scaffold. |
| samples/Keycloak/Keycloak.Web.BlazorSSR/Components/Pages/Error.razor | Error page. |
| samples/Keycloak/Keycloak.Web.BlazorSSR/Components/Pages/Counter.razor | Counter sample page. |
| samples/Keycloak/Keycloak.Web.BlazorSSR/Components/Pages/AuthRequired.razor | Authorized page showing user claim-derived details. |
| samples/Keycloak/Keycloak.Web.BlazorSSR/Components/Layout/UserMenu.razor | Login/logout UI + return URL logic for Blazor SSR. |
| samples/Keycloak/Keycloak.Web.BlazorSSR/Components/Layout/NavMenu.razor | Sidebar navigation. |
| samples/Keycloak/Keycloak.Web.BlazorSSR/Components/Layout/MainLayout.razor.css | Layout styling. |
| samples/Keycloak/Keycloak.Web.BlazorSSR/Components/Layout/MainLayout.razor | Layout markup. |
| samples/Keycloak/Keycloak.Web.BlazorSSR/Components/App.razor | Blazor SSR HTML shell. |
| samples/Keycloak/Keycloak.ServiceDefaults/KeycloakUrls.cs | Utility for resolving Keycloak realm/account console URLs. |
| samples/Keycloak/Keycloak.ServiceDefaults/KeycloakClaimsTransformation.cs | Keycloak role claim transformation for API authz. |
| samples/Keycloak/Keycloak.ServiceDefaults/KeycloakClaimTypes.cs | Keycloak claim type constants. |
| samples/Keycloak/Keycloak.ServiceDefaults/Keycloak.ServiceDefaults.csproj | Shared defaults project references (Keycloak auth + OTel + service discovery). |
| samples/Keycloak/Keycloak.ServiceDefaults/Extensions.cs | ServiceDefaults wiring (OTel, health checks, service discovery, resilience). |
| samples/Keycloak/Keycloak.ServiceDefaults/ConfigurationExtensions.cs | Helper for required configuration values. |
| samples/Keycloak/Keycloak.ServiceDefaults/ClaimsPrincipalExtensions.cs | Helpers for pulling claims and JSON claims. |
| samples/Keycloak/Keycloak.AppHost/appsettings.json | AppHost parameters/defaults for C# Keycloak sample. |
| samples/Keycloak/Keycloak.AppHost/appsettings.Development.json | AppHost dev logging overrides. |
| samples/Keycloak/Keycloak.AppHost/Properties/launchSettings.json | AppHost launch profiles/ports. |
| samples/Keycloak/Keycloak.AppHost/KeycloakExtensions.cs | AppHost extension to import sample realm + inject env vars. |
| samples/Keycloak/Keycloak.AppHost/Keycloak.AppHost.csproj | C# AppHost project configuration + Keycloak hosting package. |
| samples/Keycloak/Keycloak.AppHost/HostingExtensions.cs | Parameter helper for generated defaults and state shaping. |
| samples/Keycloak/Keycloak.AppHost/AppHost.cs | C# AppHost resource graph (Keycloak, API, Blazor SSR, Razor Pages). |
| samples/Keycloak/Keycloak.Api.Weather/appsettings.json | Weather API base config. |
| samples/Keycloak/Keycloak.Api.Weather/appsettings.Development.json | Weather API dev overrides (e.g., HTTPS metadata). |
| samples/Keycloak/Keycloak.Api.Weather/Properties/launchSettings.json | Weather API launch profiles/ports. |
| samples/Keycloak/Keycloak.Api.Weather/Program.cs | Weather API startup + Keycloak JWT bearer auth and authz policy. |
| samples/Keycloak/Keycloak.Api.Weather/Keycloak.Api.Weather.csproj | Weather API project file referencing ServiceDefaults. |
| samples/DatabaseContainers/DatabaseContainers.sln | Removes “Solution Items” section from the solution. |
| .github/skills/aspire-upgrade/SKILL.md | Adds project skill doc for upgrading Aspire samples to modern versions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I've taken @DamianEdwards' Keycloak example and: