feat(auth): migrate auth examples to dotnet user secrets#2808
feat(auth): migrate auth examples to dotnet user secrets#2808
Conversation
Add UserSecretsId to all auth example .csproj files (except BasicAuthExample) to enable dotnet user-secrets for local development. Update ClerkExample to load production secrets from CLERK_SECRETS_PATH env var when in production, falling back to user secrets in dev. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…re files Users now configure auth examples via dotnet user-secrets instead of copying appsettings.example.json to appsettings.json. The per-project .gitignore files (which only excluded appsettings.json) are no longer needed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add Services.AddSingleton(Configuration) to both UseConfiguration overloads so IConfiguration can be injected via dependency injection. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@claude review |
|
Claude finished @zachwolfe's task in 1m 9s —— View job Code Review
SummaryThis PR migrates auth examples from file-based configuration ( Issues Found1. Duplicate IConfiguration Registration (Medium)
The // Constructor (line 116)
Services.AddSingleton(Configuration);
// UseConfiguration overloads (lines 209, 216)
Services.AddSingleton(Configuration);While .NET DI won't throw an error (the last registration wins), this is confusing and could lead to subtle bugs if the Configuration property changes between calls. Suggestion: Remove the registration from the constructor and only register in 2. Typo in README (Low)
...testing the developement and production modes...Should be "development". 3. Loss of Configuration Documentation (Suggestion)The deleted Suggestion: Consider adding a comment in each example's Looks Good
Regarding Deployment FailureThe Sliplane error "Redeploy triggered for 0 service(s)" suggests a configuration/matching issue on the deployment platform rather than a code issue in this PR. The changes here affect local development configuration, not deployment infrastructure. | |
There was a problem hiding this comment.
Pull request overview
This PR updates the Ivy auth example projects to rely on .NET User Secrets (instead of repo-local appsettings.*.json patterns) for local credential management, and adds a production-only escape hatch for Clerk secrets via an external JSON file path.
Changes:
- Added
<UserSecretsId>to each auth example.csproj(Auth0, Authelia, Clerk, GitHub, Microsoft Entra, Sliplane, Supabase). - Removed per-example
appsettings.example.jsonandappsettings.jsonignore rules. - Added ClerkExample production configuration loading from a JSON file specified by
IVY_CLERK_SECRETS_PATH. - Updated
Server.UseConfiguration(...)to also registerIConfigurationin DI.
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/auth/examples/Auth0Example/appsettings.example.json | Removed sample JSON config for Auth0 example. |
| src/auth/examples/Auth0Example/Auth0Example.csproj | Added UserSecretsId for Auth0 example. |
| src/auth/examples/Auth0Example/.gitignore | Removed appsettings.json ignore entry. |
| src/auth/examples/AutheliaExample/appsettings.example.json | Removed sample JSON config for Authelia example. |
| src/auth/examples/AutheliaExample/AutheliaExample.csproj | Added UserSecretsId for Authelia example. |
| src/auth/examples/AutheliaExample/.gitignore | Removed appsettings.json ignore entry. |
| src/auth/examples/ClerkExample/appsettings.example.json | Removed sample JSON config for Clerk example. |
| src/auth/examples/ClerkExample/README.md | Added README describing production secrets-file behavior. |
| src/auth/examples/ClerkExample/Program.cs | Added production-only AddJsonFile(...) configuration hook for Clerk. |
| src/auth/examples/ClerkExample/ClerkExample.csproj | Added UserSecretsId for Clerk example. |
| src/auth/examples/ClerkExample/.gitignore | Removed appsettings.json ignore entry. |
| src/auth/examples/GitHubExample/appsettings.example.json | Removed sample JSON config for GitHub example. |
| src/auth/examples/GitHubExample/GitHubExample.csproj | Added UserSecretsId for GitHub example. |
| src/auth/examples/GitHubExample/.gitignore | Removed appsettings.json ignore entry. |
| src/auth/examples/MicrosoftEntraExample/appsettings.example.json | Removed sample JSON config for Microsoft Entra example. |
| src/auth/examples/MicrosoftEntraExample/MicrosoftEntraExample.csproj | Added UserSecretsId for Microsoft Entra example. |
| src/auth/examples/MicrosoftEntraExample/.gitignore | Removed appsettings.json ignore entry. |
| src/auth/examples/SliplaneExample/appsettings.example.json | Removed sample JSON config for Sliplane example. |
| src/auth/examples/SliplaneExample/SliplaneExample.csproj | Added UserSecretsId for Sliplane example. |
| src/auth/examples/SliplaneExample/.gitignore | Removed appsettings.json ignore entry. |
| src/auth/examples/SupabaseExample/appsettings.example.json | Removed sample JSON config for Supabase example. |
| src/auth/examples/SupabaseExample/SupabaseExample.csproj | Added UserSecretsId for Supabase example. |
| src/auth/examples/SupabaseExample/.gitignore | Removed appsettings.json ignore entry. |
| src/Ivy/Server.cs | Updated UseConfiguration(...) to also register IConfiguration into DI. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…is set Co-authored-by: zachwolfe <72848430+zachwolfe@users.noreply.github.com> Agent-Logs-Url: https://github.com/Ivy-Interactive/Ivy-Framework/sessions/c91064ce-ce4f-49f2-86f3-1e7fe29bc3f4
Redeploy failedDeployment stopped due to an error. I'm attaching the latest Sliplane events below. Logs |
Summary
Migrates all auth example projects except Basic Auth to use .NET User Secrets for local development credential management instead of hardcoded or file-based configuration.
<UserSecretsId>to each auth example.csproj(Auth0, Authelia, Clerk, GitHub, Microsoft Entra, Sliplane, Supabase)IVY_CLERK_SECRETS_PATHenvironment variable🤖 This description is AI-drafted and human-reviewed.