diff --git a/src/Ivy/Server.cs b/src/Ivy/Server.cs index 4bd51816ee..46bff32cc6 100644 --- a/src/Ivy/Server.cs +++ b/src/Ivy/Server.cs @@ -116,7 +116,8 @@ public Server(ServerArgs? args = null) }; Services.AddSingleton(_args); - Services.AddSingleton(Configuration); + // capture the latest Configuration value at resolution time in case it gets replaced by UseConfiguration() + Services.AddSingleton(_ => Configuration); AddDefaultApps(); } diff --git a/src/auth/examples/Auth0Example/.gitignore b/src/auth/examples/Auth0Example/.gitignore deleted file mode 100644 index 16bf3adb5b..0000000000 --- a/src/auth/examples/Auth0Example/.gitignore +++ /dev/null @@ -1 +0,0 @@ -appsettings.json diff --git a/src/auth/examples/Auth0Example/Auth0Example.csproj b/src/auth/examples/Auth0Example/Auth0Example.csproj index 5f13f60fdd..b770671dcd 100644 --- a/src/auth/examples/Auth0Example/Auth0Example.csproj +++ b/src/auth/examples/Auth0Example/Auth0Example.csproj @@ -6,6 +6,7 @@ enable enable Auth0Example + ivy-auth-auth0-example diff --git a/src/auth/examples/Auth0Example/appsettings.example.json b/src/auth/examples/Auth0Example/appsettings.example.json deleted file mode 100644 index 3448584d95..0000000000 --- a/src/auth/examples/Auth0Example/appsettings.example.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "Auth0": { - "Domain": "your-tenant.auth0.com", - "ClientId": "your-auth0-client-id", - "ClientSecret": "your-auth0-client-secret", - "Audience": "your-api-audience" - }, - "Google": { - "ClientId": "your-google-client-id", - "ClientSecret": "your-google-client-secret" - } -} diff --git a/src/auth/examples/AutheliaExample/.gitignore b/src/auth/examples/AutheliaExample/.gitignore deleted file mode 100644 index 16bf3adb5b..0000000000 --- a/src/auth/examples/AutheliaExample/.gitignore +++ /dev/null @@ -1 +0,0 @@ -appsettings.json diff --git a/src/auth/examples/AutheliaExample/AutheliaExample.csproj b/src/auth/examples/AutheliaExample/AutheliaExample.csproj index 989d0eb3ed..a88b9636b1 100644 --- a/src/auth/examples/AutheliaExample/AutheliaExample.csproj +++ b/src/auth/examples/AutheliaExample/AutheliaExample.csproj @@ -6,6 +6,7 @@ enable enable AutheliaExample + ivy-auth-authelia-example diff --git a/src/auth/examples/AutheliaExample/appsettings.example.json b/src/auth/examples/AutheliaExample/appsettings.example.json deleted file mode 100644 index 0bb8220eee..0000000000 --- a/src/auth/examples/AutheliaExample/appsettings.example.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "Authelia": { - "Url": "https://auth.yourdomain.com" - } -} diff --git a/src/auth/examples/ClerkExample/.gitignore b/src/auth/examples/ClerkExample/.gitignore deleted file mode 100644 index 16bf3adb5b..0000000000 --- a/src/auth/examples/ClerkExample/.gitignore +++ /dev/null @@ -1 +0,0 @@ -appsettings.json diff --git a/src/auth/examples/ClerkExample/ClerkExample.csproj b/src/auth/examples/ClerkExample/ClerkExample.csproj index 3c1f794c52..1b9a5bf4d7 100644 --- a/src/auth/examples/ClerkExample/ClerkExample.csproj +++ b/src/auth/examples/ClerkExample/ClerkExample.csproj @@ -6,6 +6,7 @@ enable enable ClerkExample + ivy-auth-clerk-example diff --git a/src/auth/examples/ClerkExample/Program.cs b/src/auth/examples/ClerkExample/Program.cs index 99c8a4e28c..56da0e7d9a 100644 --- a/src/auth/examples/ClerkExample/Program.cs +++ b/src/auth/examples/ClerkExample/Program.cs @@ -1,4 +1,5 @@ using Ivy; +using Microsoft.Extensions.Configuration; var server = new Server(); @@ -15,4 +16,21 @@ server.SetMetaTitle("Clerk Example"); +server.UseConfiguration(config => +{ + if (ProcessHelper.IsProduction()) + { + var secretsPath = Environment.GetEnvironmentVariable("IVY_CLERK_SECRETS_PATH"); + if (!string.IsNullOrEmpty(secretsPath)) + { + if (!File.Exists(secretsPath)) + { + throw new FileNotFoundException( + $"Clerk secrets file not found at path specified by IVY_CLERK_SECRETS_PATH: '{secretsPath}'"); + } + config.AddJsonFile(secretsPath, optional: false); + } + } +}); + await server.RunAsync(); diff --git a/src/auth/examples/ClerkExample/README.md b/src/auth/examples/ClerkExample/README.md new file mode 100644 index 0000000000..01a2d18dcc --- /dev/null +++ b/src/auth/examples/ClerkExample/README.md @@ -0,0 +1,5 @@ +# Clerk Example + +This example demonstrates authentication using Clerk. + +If running in production mode (`IVY_ENVIRONMENT=Production`), the example will look for configuration in a JSON file at the path stored in environment variable `IVY_CLERK_SECRETS_PATH`. This enables different secrets to be used for testing the development and production modes of Clerk. diff --git a/src/auth/examples/ClerkExample/appsettings.example.json b/src/auth/examples/ClerkExample/appsettings.example.json deleted file mode 100644 index 19f6fae2db..0000000000 --- a/src/auth/examples/ClerkExample/appsettings.example.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "Clerk": { - "PublishableKey": "pk_test_xxxxx", - "SecretKey": "sk_test_xxxxx" - }, - "Google": { - "ClientId": "your-google-client-id", - "ClientSecret": "your-google-client-secret" - } -} diff --git a/src/auth/examples/GitHubExample/.gitignore b/src/auth/examples/GitHubExample/.gitignore deleted file mode 100644 index d7be6ac5a4..0000000000 --- a/src/auth/examples/GitHubExample/.gitignore +++ /dev/null @@ -1 +0,0 @@ -appsettings.json \ No newline at end of file diff --git a/src/auth/examples/GitHubExample/GitHubExample.csproj b/src/auth/examples/GitHubExample/GitHubExample.csproj index 5e1ab44972..3c66be6012 100644 --- a/src/auth/examples/GitHubExample/GitHubExample.csproj +++ b/src/auth/examples/GitHubExample/GitHubExample.csproj @@ -6,6 +6,7 @@ enable enable GitHubExample + ivy-auth-github-example diff --git a/src/auth/examples/GitHubExample/appsettings.example.json b/src/auth/examples/GitHubExample/appsettings.example.json deleted file mode 100644 index 0c38f9a85d..0000000000 --- a/src/auth/examples/GitHubExample/appsettings.example.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "GitHub": { - "RedirectUri": "http://localhost:5010/ivy/auth/callback", - "ClientSecret": "your-github-client-secret", - "ClientId": "your-github-client-id" - } -} diff --git a/src/auth/examples/MicrosoftEntraExample/.gitignore b/src/auth/examples/MicrosoftEntraExample/.gitignore deleted file mode 100644 index 16bf3adb5b..0000000000 --- a/src/auth/examples/MicrosoftEntraExample/.gitignore +++ /dev/null @@ -1 +0,0 @@ -appsettings.json diff --git a/src/auth/examples/MicrosoftEntraExample/MicrosoftEntraExample.csproj b/src/auth/examples/MicrosoftEntraExample/MicrosoftEntraExample.csproj index 221837a509..8cb2835faf 100644 --- a/src/auth/examples/MicrosoftEntraExample/MicrosoftEntraExample.csproj +++ b/src/auth/examples/MicrosoftEntraExample/MicrosoftEntraExample.csproj @@ -6,6 +6,7 @@ enable enable MicrosoftEntraExample + ivy-auth-microsoft-entra-example diff --git a/src/auth/examples/MicrosoftEntraExample/appsettings.example.json b/src/auth/examples/MicrosoftEntraExample/appsettings.example.json deleted file mode 100644 index fb4b6f10e9..0000000000 --- a/src/auth/examples/MicrosoftEntraExample/appsettings.example.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "MicrosoftEntra": { - "TenantId": "your-tenant-id", - "ClientId": "your-client-id", - "ClientSecret": "your-client-secret" - } -} diff --git a/src/auth/examples/SliplaneExample/.gitignore b/src/auth/examples/SliplaneExample/.gitignore deleted file mode 100644 index 16bf3adb5b..0000000000 --- a/src/auth/examples/SliplaneExample/.gitignore +++ /dev/null @@ -1 +0,0 @@ -appsettings.json diff --git a/src/auth/examples/SliplaneExample/SliplaneExample.csproj b/src/auth/examples/SliplaneExample/SliplaneExample.csproj index d3344f2a7e..f1cc9c9ef8 100644 --- a/src/auth/examples/SliplaneExample/SliplaneExample.csproj +++ b/src/auth/examples/SliplaneExample/SliplaneExample.csproj @@ -6,6 +6,7 @@ enable enable SliplaneExample + ivy-auth-sliplane-example diff --git a/src/auth/examples/SliplaneExample/appsettings.example.json b/src/auth/examples/SliplaneExample/appsettings.example.json deleted file mode 100644 index 7df5d0b853..0000000000 --- a/src/auth/examples/SliplaneExample/appsettings.example.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "Sliplane": { - "ClientId": "your-sliplane-client-id", - "ClientSecret": "your-sliplane-client-secret" - } -} - diff --git a/src/auth/examples/SupabaseExample/.gitignore b/src/auth/examples/SupabaseExample/.gitignore deleted file mode 100644 index 16bf3adb5b..0000000000 --- a/src/auth/examples/SupabaseExample/.gitignore +++ /dev/null @@ -1 +0,0 @@ -appsettings.json diff --git a/src/auth/examples/SupabaseExample/SupabaseExample.csproj b/src/auth/examples/SupabaseExample/SupabaseExample.csproj index 02518972e6..8d57921bbf 100644 --- a/src/auth/examples/SupabaseExample/SupabaseExample.csproj +++ b/src/auth/examples/SupabaseExample/SupabaseExample.csproj @@ -6,6 +6,7 @@ enable enable SupabaseExample + ivy-auth-supabase-example diff --git a/src/auth/examples/SupabaseExample/appsettings.example.json b/src/auth/examples/SupabaseExample/appsettings.example.json deleted file mode 100644 index 58e670824d..0000000000 --- a/src/auth/examples/SupabaseExample/appsettings.example.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "Supabase": { - "Url": "https://your-project.supabase.co", - "ApiKey": "your-api-key" - }, - "Google": { - "ClientId": "your-google-client-id", - "ClientSecret": "your-google-client-secret" - } -}