From dd651629cb3a4e9414f87515059aeb1da03bfe00 Mon Sep 17 00:00:00 2001 From: Mark van der Wal Date: Wed, 19 May 2021 19:41:03 +0200 Subject: [PATCH 1/2] appsettings is now shared through the 'Secrets' project. secrets are now expected inside a appsettings.secrets.json inside the 'Secrets' project. --- .gitignore | 3 ++- FarmMapsBlight/FarmMapsBlight.csproj | 6 ------ FarmMapsBlight/appsettings.json | 10 ---------- FarmmapsApi/FarmmapsApi.csproj | 4 ++++ FarmmapsApi/FarmmapsProgram.cs | 1 + FarmmapsApiSamples.sln | 6 ++++++ .../FarmmapsHaulmkilling.csproj | 3 --- FarmmapsHerbicide/FarmmapsHerbicide.csproj | 3 --- FarmmapsHerbicide/appsettings.json | 10 ---------- FarmmapsNbs/FarmmapsNbs.csproj | 3 --- FarmmapsNbs/appsettings.json | 10 ---------- FarmmapsPoten/FarmmapsPoten.csproj | 3 --- FarmmapsPoten/appsettings.json | 10 ---------- FarmmapsZonering/FarmmapsZonering.csproj | 6 ------ FarmmapsZonering/appsettings.json | 10 ---------- Secrets/Secrets.csproj | 18 ++++++++++++++++++ .../appsettings.json | 2 -- 17 files changed, 31 insertions(+), 77 deletions(-) delete mode 100644 FarmMapsBlight/appsettings.json delete mode 100644 FarmmapsHerbicide/appsettings.json delete mode 100644 FarmmapsNbs/appsettings.json delete mode 100644 FarmmapsPoten/appsettings.json delete mode 100644 FarmmapsZonering/appsettings.json create mode 100644 Secrets/Secrets.csproj rename {FarmmapsHaulmkilling => Secrets}/appsettings.json (87%) diff --git a/.gitignore b/.gitignore index a8d0a12..6c59346 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .idea/ .vs/ bin/ -obj/ \ No newline at end of file +obj/ +appsettings.secrets.json \ No newline at end of file diff --git a/FarmMapsBlight/FarmMapsBlight.csproj b/FarmMapsBlight/FarmMapsBlight.csproj index dc870a8..b24d8d7 100644 --- a/FarmMapsBlight/FarmMapsBlight.csproj +++ b/FarmMapsBlight/FarmMapsBlight.csproj @@ -9,10 +9,4 @@ - - - PreserveNewest - - - diff --git a/FarmMapsBlight/appsettings.json b/FarmMapsBlight/appsettings.json deleted file mode 100644 index c5d440a..0000000 --- a/FarmMapsBlight/appsettings.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "Authority": "https://accounts.test.farmmaps.eu/", - "Endpoint": "https://test.farmmaps.eu/", - "BasePath": "api/v1", - "DiscoveryEndpointUrl": "https://accounts.test.farmmaps.eu/.well-known/openid-configuration", - "RedirectUri": "http://example.nl/api", - "ClientId": "", - "ClientSecret": "", - "Scopes": [ "api" ] -} \ No newline at end of file diff --git a/FarmmapsApi/FarmmapsApi.csproj b/FarmmapsApi/FarmmapsApi.csproj index 46a26b6..20b6873 100644 --- a/FarmmapsApi/FarmmapsApi.csproj +++ b/FarmmapsApi/FarmmapsApi.csproj @@ -18,4 +18,8 @@ + + + + diff --git a/FarmmapsApi/FarmmapsProgram.cs b/FarmmapsApi/FarmmapsProgram.cs index ea25201..5c3f3d7 100644 --- a/FarmmapsApi/FarmmapsProgram.cs +++ b/FarmmapsApi/FarmmapsProgram.cs @@ -20,6 +20,7 @@ namespace FarmmapsApi { IConfiguration config = new ConfigurationBuilder() .AddJsonFile("appsettings.json", false, true) + .AddJsonFile("appsettings.secrets.json", false, true) .Build(); var configuration = config.Get(); diff --git a/FarmmapsApiSamples.sln b/FarmmapsApiSamples.sln index 65894a6..15ec074 100644 --- a/FarmmapsApiSamples.sln +++ b/FarmmapsApiSamples.sln @@ -23,6 +23,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FarmMapsBlight", "FarmMapsB EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FarmmapsZonering", "FarmmapsZonering\FarmmapsZonering.csproj", "{91A58C4A-4A80-4079-B43D-9B851206194F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Secrets", "Secrets\Secrets.csproj", "{C4EE5ECA-253A-4B71-9F67-D231AC4517D6}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -57,6 +59,10 @@ Global {91A58C4A-4A80-4079-B43D-9B851206194F}.Debug|Any CPU.Build.0 = Debug|Any CPU {91A58C4A-4A80-4079-B43D-9B851206194F}.Release|Any CPU.ActiveCfg = Release|Any CPU {91A58C4A-4A80-4079-B43D-9B851206194F}.Release|Any CPU.Build.0 = Release|Any CPU + {C4EE5ECA-253A-4B71-9F67-D231AC4517D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C4EE5ECA-253A-4B71-9F67-D231AC4517D6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C4EE5ECA-253A-4B71-9F67-D231AC4517D6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C4EE5ECA-253A-4B71-9F67-D231AC4517D6}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/FarmmapsHaulmkilling/FarmmapsHaulmkilling.csproj b/FarmmapsHaulmkilling/FarmmapsHaulmkilling.csproj index bd82357..d4c7f60 100644 --- a/FarmmapsHaulmkilling/FarmmapsHaulmkilling.csproj +++ b/FarmmapsHaulmkilling/FarmmapsHaulmkilling.csproj @@ -6,9 +6,6 @@ - - Always - Always diff --git a/FarmmapsHerbicide/FarmmapsHerbicide.csproj b/FarmmapsHerbicide/FarmmapsHerbicide.csproj index 5e79ae2..ac5e7c3 100644 --- a/FarmmapsHerbicide/FarmmapsHerbicide.csproj +++ b/FarmmapsHerbicide/FarmmapsHerbicide.csproj @@ -6,9 +6,6 @@ - - Always - Always diff --git a/FarmmapsHerbicide/appsettings.json b/FarmmapsHerbicide/appsettings.json deleted file mode 100644 index c5d440a..0000000 --- a/FarmmapsHerbicide/appsettings.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "Authority": "https://accounts.test.farmmaps.eu/", - "Endpoint": "https://test.farmmaps.eu/", - "BasePath": "api/v1", - "DiscoveryEndpointUrl": "https://accounts.test.farmmaps.eu/.well-known/openid-configuration", - "RedirectUri": "http://example.nl/api", - "ClientId": "", - "ClientSecret": "", - "Scopes": [ "api" ] -} \ No newline at end of file diff --git a/FarmmapsNbs/FarmmapsNbs.csproj b/FarmmapsNbs/FarmmapsNbs.csproj index 05c7803..a62a786 100644 --- a/FarmmapsNbs/FarmmapsNbs.csproj +++ b/FarmmapsNbs/FarmmapsNbs.csproj @@ -6,9 +6,6 @@ - - Always - Always diff --git a/FarmmapsNbs/appsettings.json b/FarmmapsNbs/appsettings.json deleted file mode 100644 index c5d440a..0000000 --- a/FarmmapsNbs/appsettings.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "Authority": "https://accounts.test.farmmaps.eu/", - "Endpoint": "https://test.farmmaps.eu/", - "BasePath": "api/v1", - "DiscoveryEndpointUrl": "https://accounts.test.farmmaps.eu/.well-known/openid-configuration", - "RedirectUri": "http://example.nl/api", - "ClientId": "", - "ClientSecret": "", - "Scopes": [ "api" ] -} \ No newline at end of file diff --git a/FarmmapsPoten/FarmmapsPoten.csproj b/FarmmapsPoten/FarmmapsPoten.csproj index 1ff2fe3..94e1361 100644 --- a/FarmmapsPoten/FarmmapsPoten.csproj +++ b/FarmmapsPoten/FarmmapsPoten.csproj @@ -6,9 +6,6 @@ - - Always - Always diff --git a/FarmmapsPoten/appsettings.json b/FarmmapsPoten/appsettings.json deleted file mode 100644 index c5d440a..0000000 --- a/FarmmapsPoten/appsettings.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "Authority": "https://accounts.test.farmmaps.eu/", - "Endpoint": "https://test.farmmaps.eu/", - "BasePath": "api/v1", - "DiscoveryEndpointUrl": "https://accounts.test.farmmaps.eu/.well-known/openid-configuration", - "RedirectUri": "http://example.nl/api", - "ClientId": "", - "ClientSecret": "", - "Scopes": [ "api" ] -} \ No newline at end of file diff --git a/FarmmapsZonering/FarmmapsZonering.csproj b/FarmmapsZonering/FarmmapsZonering.csproj index 6f9fc2a..48494e4 100644 --- a/FarmmapsZonering/FarmmapsZonering.csproj +++ b/FarmmapsZonering/FarmmapsZonering.csproj @@ -6,15 +6,9 @@ - - Always - Always - - Always - diff --git a/FarmmapsZonering/appsettings.json b/FarmmapsZonering/appsettings.json deleted file mode 100644 index c5d440a..0000000 --- a/FarmmapsZonering/appsettings.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "Authority": "https://accounts.test.farmmaps.eu/", - "Endpoint": "https://test.farmmaps.eu/", - "BasePath": "api/v1", - "DiscoveryEndpointUrl": "https://accounts.test.farmmaps.eu/.well-known/openid-configuration", - "RedirectUri": "http://example.nl/api", - "ClientId": "", - "ClientSecret": "", - "Scopes": [ "api" ] -} \ No newline at end of file diff --git a/Secrets/Secrets.csproj b/Secrets/Secrets.csproj new file mode 100644 index 0000000..f12914f --- /dev/null +++ b/Secrets/Secrets.csproj @@ -0,0 +1,18 @@ + + + + netstandard1.0 + + + + + + Always + + + + Always + + + + diff --git a/FarmmapsHaulmkilling/appsettings.json b/Secrets/appsettings.json similarity index 87% rename from FarmmapsHaulmkilling/appsettings.json rename to Secrets/appsettings.json index bbc63bb..1e2ea36 100644 --- a/FarmmapsHaulmkilling/appsettings.json +++ b/Secrets/appsettings.json @@ -4,7 +4,5 @@ "BasePath": "api/v1", "DiscoveryEndpointUrl": "https://accounts.test.farmmaps.eu/.well-known/openid-configuration", "RedirectUri": "http://example.nl/api", - "ClientId": "", - "ClientSecret": "", "Scopes": ["api"] } \ No newline at end of file From 8bbf808c5561da2c8149cf7db206d80f02a54bc5 Mon Sep 17 00:00:00 2001 From: Mark van der Wal Date: Wed, 19 May 2021 19:42:58 +0200 Subject: [PATCH 2/2] update README.MD --- README.MD | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/README.MD b/README.MD index 3eb0045..43ba6c7 100644 --- a/README.MD +++ b/README.MD @@ -1,6 +1,14 @@ ##### NOT PRODUCTION READY CODE, JUST AN EXAMPLE -Put your clientId and clientSecret in the appsettings.json. +Put your clientId and clientSecret in a newly created appsettings.secrets.json file inside the root of the Secrets project. + +**appsettings.secrets.json** +``` +{ + "ClientId": "", + "ClientSecret": "" +} +``` * Isn't 100% complete. * Needs proper testing of all public api methods.