Browse Source

Removing duplicated AutoAuthorizeMiddleware

pull/1894/head
CountNeuroman 2 years ago
parent
commit
f0363e2586
8 changed files with 10 additions and 56 deletions
  1. +0
    -26
      src/Services/Basket/Basket.FunctionalTests/Base/AutoAuthorizeMiddleware.cs
  2. +1
    -1
      src/Services/Basket/Basket.FunctionalTests/Base/BasketTestStartup.cs
  3. +1
    -0
      src/Services/Basket/Basket.FunctionalTests/Basket.FunctionalTests.csproj
  4. +3
    -1
      src/Services/Basket/Basket.FunctionalTests/BasketScenarios.cs
  5. +0
    -26
      src/Services/Ordering/Ordering.FunctionalTests/AutoAuthorizeMiddleware.cs
  6. +1
    -0
      src/Services/Ordering/Ordering.FunctionalTests/Ordering.FunctionalTests.csproj
  7. +3
    -1
      src/Services/Ordering/Ordering.FunctionalTests/OrderingTestStartup.cs
  8. +1
    -1
      src/Tests/Services/Application.FunctionalTests/Middleware/AutoAuthorizeMiddleware.cs

+ 0
- 26
src/Services/Basket/Basket.FunctionalTests/Base/AutoAuthorizeMiddleware.cs View File

@ -1,26 +0,0 @@
namespace Basket.FunctionalTests.Base;
class AutoAuthorizeMiddleware
{
public const string IDENTITY_ID = "9e3163b9-1ae6-4652-9dc6-7898ab7b7a00";
private readonly RequestDelegate _next;
public AutoAuthorizeMiddleware(RequestDelegate rd)
{
_next = rd;
}
public async Task Invoke(HttpContext httpContext)
{
var identity = new ClaimsIdentity("cookies");
identity.AddClaim(new Claim("sub", IDENTITY_ID));
identity.AddClaim(new Claim("unique_name", IDENTITY_ID));
identity.AddClaim(new Claim(ClaimTypes.Name, IDENTITY_ID));
httpContext.User.AddIdentity(identity);
await _next.Invoke(httpContext);
}
}

+ 1
- 1
src/Services/Basket/Basket.FunctionalTests/Base/BasketTestStartup.cs View File

@ -1,4 +1,4 @@

using FunctionalTests.Middleware;
namespace Basket.FunctionalTests.Base namespace Basket.FunctionalTests.Base
{ {


+ 1
- 0
src/Services/Basket/Basket.FunctionalTests/Basket.FunctionalTests.csproj View File

@ -29,6 +29,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\Tests\Services\Application.FunctionalTests\Application.FunctionalTests.csproj" />
<ProjectReference Include="..\Basket.API\Basket.API.csproj" /> <ProjectReference Include="..\Basket.API\Basket.API.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

+ 3
- 1
src/Services/Basket/Basket.FunctionalTests/BasketScenarios.cs View File

@ -1,4 +1,6 @@
namespace Basket.FunctionalTests;
using FunctionalTests.Middleware;
namespace Basket.FunctionalTests;
public class BasketScenarios public class BasketScenarios
: BasketScenarioBase : BasketScenarioBase


+ 0
- 26
src/Services/Ordering/Ordering.FunctionalTests/AutoAuthorizeMiddleware.cs View File

@ -1,26 +0,0 @@
namespace Ordering.FunctionalTests;
class AutoAuthorizeMiddleware
{
public const string IDENTITY_ID = "9e3163b9-1ae6-4652-9dc6-7898ab7b7a00";
private readonly RequestDelegate _next;
public AutoAuthorizeMiddleware(RequestDelegate rd)
{
_next = rd;
}
public async Task Invoke(HttpContext httpContext)
{
var identity = new ClaimsIdentity("cookies");
identity.AddClaim(new Claim("sub", IDENTITY_ID));
identity.AddClaim(new Claim("unique_name", IDENTITY_ID));
identity.AddClaim(new Claim(ClaimTypes.Name, IDENTITY_ID));
httpContext.User.AddIdentity(identity);
await _next.Invoke(httpContext);
}
}

+ 1
- 0
src/Services/Ordering/Ordering.FunctionalTests/Ordering.FunctionalTests.csproj View File

@ -28,6 +28,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\Tests\Services\Application.FunctionalTests\Application.FunctionalTests.csproj" />
<ProjectReference Include="..\..\..\Web\WebMVC\WebMVC.csproj" /> <ProjectReference Include="..\..\..\Web\WebMVC\WebMVC.csproj" />
<ProjectReference Include="..\Ordering.API\Ordering.API.csproj" /> <ProjectReference Include="..\Ordering.API\Ordering.API.csproj" />
<ProjectReference Include="..\Ordering.Domain\Ordering.Domain.csproj" /> <ProjectReference Include="..\Ordering.Domain\Ordering.Domain.csproj" />


+ 3
- 1
src/Services/Ordering/Ordering.FunctionalTests/OrderingTestStartup.cs View File

@ -1,4 +1,6 @@
namespace Ordering.FunctionalTests;
using FunctionalTests.Middleware;
namespace Ordering.FunctionalTests;
public class OrderingTestsStartup : Startup public class OrderingTestsStartup : Startup
{ {


+ 1
- 1
src/Tests/Services/Application.FunctionalTests/Middleware/AutoAuthorizeMiddleware.cs View File

@ -1,6 +1,6 @@
namespace FunctionalTests.Middleware; namespace FunctionalTests.Middleware;
class AutoAuthorizeMiddleware
public class AutoAuthorizeMiddleware
{ {
public const string IDENTITY_ID = "9e3163b9-1ae6-4652-9dc6-7898ab7b7a00"; public const string IDENTITY_ID = "9e3163b9-1ae6-4652-9dc6-7898ab7b7a00";


Loading…
Cancel
Save