Removing duplicated AutoAuthorizeMiddleware
This commit is contained in:
parent
3af7133157
commit
f0363e2586
@ -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,4 +1,4 @@
|
||||
|
||||
using FunctionalTests.Middleware;
|
||||
|
||||
namespace Basket.FunctionalTests.Base
|
||||
{
|
||||
|
@ -29,6 +29,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\Tests\Services\Application.FunctionalTests\Application.FunctionalTests.csproj" />
|
||||
<ProjectReference Include="..\Basket.API\Basket.API.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
@ -1,4 +1,6 @@
|
||||
namespace Basket.FunctionalTests;
|
||||
using FunctionalTests.Middleware;
|
||||
|
||||
namespace Basket.FunctionalTests;
|
||||
|
||||
public class BasketScenarios
|
||||
: BasketScenarioBase
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
@ -28,6 +28,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\Tests\Services\Application.FunctionalTests\Application.FunctionalTests.csproj" />
|
||||
<ProjectReference Include="..\..\..\Web\WebMVC\WebMVC.csproj" />
|
||||
<ProjectReference Include="..\Ordering.API\Ordering.API.csproj" />
|
||||
<ProjectReference Include="..\Ordering.Domain\Ordering.Domain.csproj" />
|
||||
|
@ -1,4 +1,6 @@
|
||||
namespace Ordering.FunctionalTests;
|
||||
using FunctionalTests.Middleware;
|
||||
|
||||
namespace Ordering.FunctionalTests;
|
||||
|
||||
public class OrderingTestsStartup : Startup
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
namespace FunctionalTests.Middleware;
|
||||
|
||||
class AutoAuthorizeMiddleware
|
||||
public class AutoAuthorizeMiddleware
|
||||
{
|
||||
public const string IDENTITY_ID = "9e3163b9-1ae6-4652-9dc6-7898ab7b7a00";
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user