From 8ea1daacb464387f51504724ca4599779b05cf80 Mon Sep 17 00:00:00 2001 From: Danny Logsdon Date: Sun, 5 May 2024 10:24:37 -0400 Subject: [PATCH] * Bug fixes to ApiClient and BearerTokenClient to support security microservice * Add ServiceBricks.Xunit.Debug project --- ServiceBricksV1.sln | 6 ++ .../ServiceBricks.Debug.csproj | 2 +- ...erviceBricks.ServiceBus.Azure.Debug.csproj | 2 +- .../ServiceBricks.ServiceBus.Azure.csproj | 4 +- ...ricks.Storage.AzureDataTables.Debug.csproj | 2 +- ...rviceBricks.Storage.AzureDataTables.csproj | 4 +- ...s.Storage.EntityFrameworkCore.Debug.csproj | 2 +- ...eBricks.Storage.EntityFrameworkCore.csproj | 4 +- ...ServiceBricks.Storage.MongoDb.Debug.csproj | 2 +- .../ServiceBricks.Storage.MongoDb.csproj | 4 +- .../ServiceBricks.Xunit.Debug.csproj | 88 ++++++++++++++++++ .../ServiceBricks.Xunit.snk | Bin 0 -> 596 bytes .../ServiceBricks.Xunit.csproj | 4 +- src/V1/ServiceBricks/Api/ApiClient.cs | 10 +- .../Service/BearerTokenClient.cs | 2 - src/V1/ServiceBricks/ServiceBricks.csproj | 2 +- 16 files changed, 114 insertions(+), 24 deletions(-) create mode 100644 src/V1/ServiceBricks.Xunit.Debug/ServiceBricks.Xunit.Debug.csproj create mode 100644 src/V1/ServiceBricks.Xunit.Debug/ServiceBricks.Xunit.snk diff --git a/ServiceBricksV1.sln b/ServiceBricksV1.sln index 2eba457..067f3e5 100644 --- a/ServiceBricksV1.sln +++ b/ServiceBricksV1.sln @@ -57,6 +57,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServiceBricks.Storage.Azure EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServiceBricks.Storage.AzureDataTables.Debug", "src\V1\ServiceBricks.Storage.AzureDataTables.Debug\ServiceBricks.Storage.AzureDataTables.Debug.csproj", "{2A9F4A46-06B7-4645-B91E-AEEB8536B985}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServiceBricks.Xunit.Debug", "src\V1\ServiceBricks.Xunit.Debug\ServiceBricks.Xunit.Debug.csproj", "{E8CFF68F-4B25-49CF-A4FF-59F846254239}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -155,6 +157,10 @@ Global {2A9F4A46-06B7-4645-B91E-AEEB8536B985}.Debug|Any CPU.Build.0 = Debug|Any CPU {2A9F4A46-06B7-4645-B91E-AEEB8536B985}.Release|Any CPU.ActiveCfg = Release|Any CPU {2A9F4A46-06B7-4645-B91E-AEEB8536B985}.Release|Any CPU.Build.0 = Release|Any CPU + {E8CFF68F-4B25-49CF-A4FF-59F846254239}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E8CFF68F-4B25-49CF-A4FF-59F846254239}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E8CFF68F-4B25-49CF-A4FF-59F846254239}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E8CFF68F-4B25-49CF-A4FF-59F846254239}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/V1/ServiceBricks.Debug/ServiceBricks.Debug.csproj b/src/V1/ServiceBricks.Debug/ServiceBricks.Debug.csproj index 9a5b911..51cd779 100644 --- a/src/V1/ServiceBricks.Debug/ServiceBricks.Debug.csproj +++ b/src/V1/ServiceBricks.Debug/ServiceBricks.Debug.csproj @@ -1,7 +1,7 @@ - 1.0.4 + 1.0.5 ServiceBricks is the cornerstone for building a microservices foundation. Visit http://ServiceBricks.com to learn more. ServiceBricks holomodular diff --git a/src/V1/ServiceBricks.ServiceBus.Azure.Debug/ServiceBricks.ServiceBus.Azure.Debug.csproj b/src/V1/ServiceBricks.ServiceBus.Azure.Debug/ServiceBricks.ServiceBus.Azure.Debug.csproj index ee3b913..25ce11e 100644 --- a/src/V1/ServiceBricks.ServiceBus.Azure.Debug/ServiceBricks.ServiceBus.Azure.Debug.csproj +++ b/src/V1/ServiceBricks.ServiceBus.Azure.Debug/ServiceBricks.ServiceBus.Azure.Debug.csproj @@ -1,7 +1,7 @@ - 1.0.4 + 1.0.5 ServiceBricks is the cornerstone for building a microservices foundation. Visit http://ServiceBricks.com to learn more. ServiceBricks.ServiceBus.Azure holomodular diff --git a/src/V1/ServiceBricks.ServiceBus.Azure/ServiceBricks.ServiceBus.Azure.csproj b/src/V1/ServiceBricks.ServiceBus.Azure/ServiceBricks.ServiceBus.Azure.csproj index b1fe2d8..3af6ca0 100644 --- a/src/V1/ServiceBricks.ServiceBus.Azure/ServiceBricks.ServiceBus.Azure.csproj +++ b/src/V1/ServiceBricks.ServiceBus.Azure/ServiceBricks.ServiceBus.Azure.csproj @@ -1,7 +1,7 @@ - 1.0.4 + 1.0.5 ServiceBricks is the cornerstone for building a microservices foundation. Visit http://ServiceBricks.com to learn more. ServiceBricks.ServiceBus.Azure holomodular @@ -29,7 +29,7 @@ - + diff --git a/src/V1/ServiceBricks.Storage.AzureDataTables.Debug/ServiceBricks.Storage.AzureDataTables.Debug.csproj b/src/V1/ServiceBricks.Storage.AzureDataTables.Debug/ServiceBricks.Storage.AzureDataTables.Debug.csproj index 4d45466..6149dd1 100644 --- a/src/V1/ServiceBricks.Storage.AzureDataTables.Debug/ServiceBricks.Storage.AzureDataTables.Debug.csproj +++ b/src/V1/ServiceBricks.Storage.AzureDataTables.Debug/ServiceBricks.Storage.AzureDataTables.Debug.csproj @@ -1,7 +1,7 @@ - 1.0.4 + 1.0.5 ServiceBricks is the cornerstone for building a microservices foundation. Visit http://ServiceBricks.com to learn more. ServiceBricks.Storage.AzureDataTables holomodular diff --git a/src/V1/ServiceBricks.Storage.AzureDataTables/ServiceBricks.Storage.AzureDataTables.csproj b/src/V1/ServiceBricks.Storage.AzureDataTables/ServiceBricks.Storage.AzureDataTables.csproj index f989007..7d9b738 100644 --- a/src/V1/ServiceBricks.Storage.AzureDataTables/ServiceBricks.Storage.AzureDataTables.csproj +++ b/src/V1/ServiceBricks.Storage.AzureDataTables/ServiceBricks.Storage.AzureDataTables.csproj @@ -1,7 +1,7 @@ - 1.0.4 + 1.0.5 ServiceBricks is the cornerstone for building a microservices foundation. Visit http://ServiceBricks.com to learn more. ServiceBricks.Storage.AzureDataTables holomodular @@ -30,7 +30,7 @@ - + diff --git a/src/V1/ServiceBricks.Storage.EntityFrameworkCore.Debug/ServiceBricks.Storage.EntityFrameworkCore.Debug.csproj b/src/V1/ServiceBricks.Storage.EntityFrameworkCore.Debug/ServiceBricks.Storage.EntityFrameworkCore.Debug.csproj index bb1da7d..b2bd610 100644 --- a/src/V1/ServiceBricks.Storage.EntityFrameworkCore.Debug/ServiceBricks.Storage.EntityFrameworkCore.Debug.csproj +++ b/src/V1/ServiceBricks.Storage.EntityFrameworkCore.Debug/ServiceBricks.Storage.EntityFrameworkCore.Debug.csproj @@ -1,7 +1,7 @@ - 1.0.4 + 1.0.5 ServiceBricks is the cornerstone for building a microservices foundation. Visit http://ServiceBricks.com to learn more. ServiceBricks.Storage.EntityFrameworkCore holomodular diff --git a/src/V1/ServiceBricks.Storage.EntityFrameworkCore/ServiceBricks.Storage.EntityFrameworkCore.csproj b/src/V1/ServiceBricks.Storage.EntityFrameworkCore/ServiceBricks.Storage.EntityFrameworkCore.csproj index d66f992..1970e96 100644 --- a/src/V1/ServiceBricks.Storage.EntityFrameworkCore/ServiceBricks.Storage.EntityFrameworkCore.csproj +++ b/src/V1/ServiceBricks.Storage.EntityFrameworkCore/ServiceBricks.Storage.EntityFrameworkCore.csproj @@ -1,7 +1,7 @@ - 1.0.4 + 1.0.5 ServiceBricks is the cornerstone for building a microservices foundation. Visit http://ServiceBricks.com to learn more. ServiceBricks.Storage.EntityFrameworkCore holomodular @@ -30,7 +30,7 @@ - + diff --git a/src/V1/ServiceBricks.Storage.MongoDb.Debug/ServiceBricks.Storage.MongoDb.Debug.csproj b/src/V1/ServiceBricks.Storage.MongoDb.Debug/ServiceBricks.Storage.MongoDb.Debug.csproj index 787c173..49202f7 100644 --- a/src/V1/ServiceBricks.Storage.MongoDb.Debug/ServiceBricks.Storage.MongoDb.Debug.csproj +++ b/src/V1/ServiceBricks.Storage.MongoDb.Debug/ServiceBricks.Storage.MongoDb.Debug.csproj @@ -1,7 +1,7 @@ - 1.0.4 + 1.0.5 ServiceBricks is the cornerstone for building a microservices foundation. Visit http://ServiceBricks.com to learn more. ServiceBricks.Storage.MongoDb holomodular diff --git a/src/V1/ServiceBricks.Storage.MongoDb/ServiceBricks.Storage.MongoDb.csproj b/src/V1/ServiceBricks.Storage.MongoDb/ServiceBricks.Storage.MongoDb.csproj index 8042bb7..d7cb51c 100644 --- a/src/V1/ServiceBricks.Storage.MongoDb/ServiceBricks.Storage.MongoDb.csproj +++ b/src/V1/ServiceBricks.Storage.MongoDb/ServiceBricks.Storage.MongoDb.csproj @@ -1,7 +1,7 @@ - 1.0.4 + 1.0.5 ServiceBricks is the cornerstone for building a microservices foundation. Visit http://ServiceBricks.com to learn more. ServiceBricks.Storage.MongoDb holomodular @@ -30,7 +30,7 @@ - + diff --git a/src/V1/ServiceBricks.Xunit.Debug/ServiceBricks.Xunit.Debug.csproj b/src/V1/ServiceBricks.Xunit.Debug/ServiceBricks.Xunit.Debug.csproj new file mode 100644 index 0000000..373b59b --- /dev/null +++ b/src/V1/ServiceBricks.Xunit.Debug/ServiceBricks.Xunit.Debug.csproj @@ -0,0 +1,88 @@ + + + + 1.0.5 + ServiceBricks is the cornerstone for building a microservices foundation. Visit http://ServiceBricks.com to learn more. + ServiceBricks.Xunit + holomodular + net6.0;net7.0;net8.0 + disable + Copyright © 2023 HoloModular LLC. All Rights Reserved. Visit http://HoloModular.com to learn more. + http://ServiceBricks.com + logo.png + service;bricks; + MIT + True + ServiceBricks.Xunit.snk + readme.md + enable + False + git + https://github.com/holomodular/ServiceBricks + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + diff --git a/src/V1/ServiceBricks.Xunit.Debug/ServiceBricks.Xunit.snk b/src/V1/ServiceBricks.Xunit.Debug/ServiceBricks.Xunit.snk new file mode 100644 index 0000000000000000000000000000000000000000..a1ff978237ae4111885de62fe349170ed3bb567d GIT binary patch literal 596 zcmV-a0;~N80ssI2Bme+XQ$aES1ONa50096Mr?_(Od1u3k&~iBm9EJ&li;q!lsOJ=2 zskayeGusoy6hx<5z|O3zQ4A6>H1{106K$(-6qe4gK4g;gnhV<{x05l}53g6~5bNUr zjhaL!WNUw^ykR8nZ;zZ$-;C(_)vQ_$urvjXVbCunCt_)(guS&_1Q!*t=t0+^-BGvq z*v7=)e3p9MB$m#qYy$_bfD3)NV#IPDy!qtVLRuGcl{96LhFOTeSYcb*YYr#mssEq9 z`J^suN%=MW4d&ESX%$WVTB$WS;S;~=X^cZrubW(^1$hg0#0%_gzJQ0}Nlj;2% zUH0zI04T^WQ{LiNx7rEq#TA7l(r(;s@ru*D)L;K_UJKxGl5C+^I+zV-WkG`1M-*T2 zgb|&ruwW~le2zmYiv1NcX70c;lYwx>?_+V>ZNJI`Dif9C>g7_O+4T812d>G?gC?#6 zg?84%(o`Jy_o*bJ(hIaImiFR>K!mb`LqVUE0F`yxs>w|Z-71>mos8~1pFqx>b$~N> zfeh-#tgNKqJtc1b<%oKth)Y}+pZf~Za_~Ih9b7+oaLBMf$V9>i$;0eFB)}gt?h8D1 zS5i2Xe=pSGc1a;+rp!-ZEsV+c%bUpOWBB6mq3+-;4cDJ!pJ0e1TPKCP4}eo3?X5tI zAki}L=7FmH7?nIcS6v@y9*7x_9mJY?Yfq|EwezfUvo(17TQ<8D%7jc1N&|7%tnjBC ip{sAXnLiRQQ^FHuznp5b>PP2<97^KfQgIUk2%r;RMkA>J literal 0 HcmV?d00001 diff --git a/src/V1/ServiceBricks.Xunit/ServiceBricks.Xunit.csproj b/src/V1/ServiceBricks.Xunit/ServiceBricks.Xunit.csproj index 0ebae1b..9bfa971 100644 --- a/src/V1/ServiceBricks.Xunit/ServiceBricks.Xunit.csproj +++ b/src/V1/ServiceBricks.Xunit/ServiceBricks.Xunit.csproj @@ -1,7 +1,7 @@  - 1.0.4 + 1.0.5 ServiceBricks is the cornerstone for building a microservices foundation. Visit http://ServiceBricks.com to learn more. ServiceBricks.Xunit holomodular @@ -31,7 +31,7 @@ - + diff --git a/src/V1/ServiceBricks/Api/ApiClient.cs b/src/V1/ServiceBricks/Api/ApiClient.cs index 0e72219..256396e 100644 --- a/src/V1/ServiceBricks/Api/ApiClient.cs +++ b/src/V1/ServiceBricks/Api/ApiClient.cs @@ -90,6 +90,8 @@ public virtual async Task> ExecuteAsync(HttpReques } else { + resp.AddMessage(ResponseMessage.CreateError(LocalizationResource.ERROR_REST_CLIENT)); + _logger.LogWarning($"{result.StatusCode} {request.RequestUri}"); if (_apiConfig.ReturnResponseObject) { var content = await result.Content.ReadAsStringAsync(); @@ -99,17 +101,13 @@ public virtual async Task> ExecuteAsync(HttpReques { resp.Item = JsonConvert.DeserializeObject(content); } - return resp; - } - else - { - resp.AddMessage(ResponseMessage.CreateError(LocalizationResource.ERROR_REST_CLIENT)); - return resp; } + return resp; } } else { + _logger.LogError("ApiClient SendAsync returned null"); resp.AddMessage(ResponseMessage.CreateError(LocalizationResource.ERROR_REST_CLIENT)); return resp; } diff --git a/src/V1/ServiceBricks/Service/BearerTokenClient.cs b/src/V1/ServiceBricks/Service/BearerTokenClient.cs index 09c6568..ecc4c02 100644 --- a/src/V1/ServiceBricks/Service/BearerTokenClient.cs +++ b/src/V1/ServiceBricks/Service/BearerTokenClient.cs @@ -85,7 +85,6 @@ public virtual IResponseItem GetAccessToken() try { HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, _bearerTokenCredentials.AuthorizationUrl); - request.Headers.Add(HEADER_CONTENTTYPE, CONTENTTYPE_APPLICATIONJSON); string data = JsonConvert.SerializeObject(_bearerTokenCredentials.AccessTokenRequest); request.Content = new StringContent(data, Encoding.UTF8, CONTENTTYPE_APPLICATIONJSON); var result = base.Send(request); @@ -124,7 +123,6 @@ public virtual async Task> GetAccessTokenAsyn try { HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, _bearerTokenCredentials.AuthorizationUrl); - request.Headers.Add(HEADER_CONTENTTYPE, CONTENTTYPE_APPLICATIONJSON); string data = JsonConvert.SerializeObject(_bearerTokenCredentials.AccessTokenRequest); request.Content = new StringContent(data, Encoding.UTF8, CONTENTTYPE_APPLICATIONJSON); var result = await base.SendAsync(request); diff --git a/src/V1/ServiceBricks/ServiceBricks.csproj b/src/V1/ServiceBricks/ServiceBricks.csproj index e92cab9..c6b9a8f 100644 --- a/src/V1/ServiceBricks/ServiceBricks.csproj +++ b/src/V1/ServiceBricks/ServiceBricks.csproj @@ -1,7 +1,7 @@ - 1.0.4 + 1.0.5 ServiceBricks is the cornerstone for building a microservices foundation. Visit http://ServiceBricks.com to learn more. ServiceBricks holomodular