PR to merge into skynode dev branchpull/391/head
@ -1,6 +1,6 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<Application Name="fabric:/Bus" xmlns="http://schemas.microsoft.com/2011/01/fabric" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |||
<Parameters> | |||
<Parameter Name="RabbitMQ_InstanceCount" Value="-1" /> | |||
<Parameter Name="RabbitMQ_InstanceCount" Value="1" /> | |||
</Parameters> | |||
</Application> |
@ -1,6 +1,6 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<Application Name="fabric:/NoSQL" xmlns="http://schemas.microsoft.com/2011/01/fabric" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |||
<Parameters> | |||
<Parameter Name="MongoDB_InstanceCount" Value="-1" /> | |||
<Parameter Name="MongoDB_InstanceCount" Value="1" /> | |||
</Parameters> | |||
</Application> |
@ -1,6 +1,6 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<Application Name="fabric:/Redis" xmlns="http://schemas.microsoft.com/2011/01/fabric" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |||
<Parameters> | |||
<Parameter Name="BasketData_InstanceCount" Value="-1" /> | |||
<Parameter Name="BasketData_InstanceCount" Value="1" /> | |||
</Parameters> | |||
</Application> |
@ -1,6 +1,6 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<Application Name="fabric:/Sql" xmlns="http://schemas.microsoft.com/2011/01/fabric" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |||
<Parameters> | |||
<Parameter Name="SqlServer_InstanceCount" Value="-1" /> | |||
<Parameter Name="SqlServer_InstanceCount" Value="1" /> | |||
</Parameters> | |||
</Application> |
@ -1,14 +1,15 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<Application Name="fabric:/eShopOnServiceFabric" xmlns="http://schemas.microsoft.com/2011/01/fabric" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |||
<Parameters> | |||
<Parameter Name="MarketingApi_InstanceCount" Value="-1" /> | |||
<Parameter Name="LocationsApi_InstanceCount" Value="-1" /> | |||
<Parameter Name="PaymentApi_InstanceCount" Value="-1" /> | |||
<Parameter Name="OrderingApi_InstanceCount" Value="-1" /> | |||
<Parameter Name="CatalogApi_InstanceCount" Value="-1" /> | |||
<Parameter Name="BasketApi_InstanceCount" Value="-1" /> | |||
<Parameter Name="MarketingApi_InstanceCount" Value="1" /> | |||
<Parameter Name="LocationsApi_InstanceCount" Value="1" /> | |||
<Parameter Name="PaymentApi_InstanceCount" Value="1" /> | |||
<Parameter Name="OrderingApi_InstanceCount" Value="1" /> | |||
<Parameter Name="CatalogApi_InstanceCount" Value="1" /> | |||
<Parameter Name="BasketApi_InstanceCount" Value="1" /> | |||
<Parameter Name="IdentityUrlExternal" Value="http://#{your_sf_dns}#:5105" /> | |||
<Parameter Name="PicBaseUrl" Value="http://#{your_sf_dns}#:5101/api/v1/catalog/items/[0]/pic/" /> | |||
<Parameter Name="PicBaseUrlCatalog" Value="http://#{your_sf_dns}#:5101/api/v1/catalog/items/[0]/pic/" /> | |||
<Parameter Name="PicBaseUrlMarketing" Value="http://#{your_sf_dns}#:5110/api/v1/campaigns/[0]/pic/" /> | |||
<Parameter Name="InstrumentationKey" Value="" /> | |||
</Parameters> | |||
</Application> |
@ -1,7 +1,7 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<Application Name="fabric:/eShopOnServiceFabricWebMVC" xmlns="http://schemas.microsoft.com/2011/01/fabric" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |||
<Parameters> | |||
<Parameter Name="WebMVC_InstanceCount" Value="-1" /> | |||
<Parameter Name="WebMVC_InstanceCount" Value="1" /> | |||
<Parameter Name="IdentityUrl" Value="http://#{your_sf_dns}#:5105" /> | |||
<Parameter Name="InstrumentationKey" Value="" /> | |||
</Parameters> |
@ -1,7 +1,7 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<Application Name="fabric:/eShopOnServiceFabricWebStatus" xmlns="http://schemas.microsoft.com/2011/01/fabric" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |||
<Parameters> | |||
<Parameter Name="WebStatus_InstanceCount" Value="-1" /> | |||
<Parameter Name="WebStatus_InstanceCount" Value="1" /> | |||
<Parameter Name="InstrumentationKey" Value="" /> | |||
</Parameters> | |||
</Application> |
@ -1,6 +1,6 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<Application Name="fabric:/Bus" xmlns="http://schemas.microsoft.com/2011/01/fabric" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |||
<Parameters> | |||
<Parameter Name="RabbitMQ_InstanceCount" Value="-1" /> | |||
<Parameter Name="RabbitMQ_InstanceCount" Value="1" /> | |||
</Parameters> | |||
</Application> |
@ -1,6 +1,6 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<Application Name="fabric:/NoSQL" xmlns="http://schemas.microsoft.com/2011/01/fabric" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |||
<Parameters> | |||
<Parameter Name="MongoDB_InstanceCount" Value="-1" /> | |||
<Parameter Name="MongoDB_InstanceCount" Value="1" /> | |||
</Parameters> | |||
</Application> |
@ -1,6 +1,6 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<Application Name="fabric:/Redis" xmlns="http://schemas.microsoft.com/2011/01/fabric" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |||
<Parameters> | |||
<Parameter Name="BasketData_InstanceCount" Value="-1" /> | |||
<Parameter Name="BasketData_InstanceCount" Value="1" /> | |||
</Parameters> | |||
</Application> |
@ -1,6 +1,6 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<Application Name="fabric:/Sql" xmlns="http://schemas.microsoft.com/2011/01/fabric" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |||
<Parameters> | |||
<Parameter Name="SqlServer_InstanceCount" Value="-1" /> | |||
<Parameter Name="SqlServer_InstanceCount" Value="1" /> | |||
</Parameters> | |||
</Application> |
@ -1,14 +1,15 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<Application Name="fabric:/eShopOnServiceFabric" xmlns="http://schemas.microsoft.com/2011/01/fabric" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |||
<Parameters> | |||
<Parameter Name="MarketingApi_InstanceCount" Value="-1" /> | |||
<Parameter Name="LocationsApi_InstanceCount" Value="-1" /> | |||
<Parameter Name="PaymentApi_InstanceCount" Value="-1" /> | |||
<Parameter Name="OrderingApi_InstanceCount" Value="-1" /> | |||
<Parameter Name="CatalogApi_InstanceCount" Value="-1" /> | |||
<Parameter Name="BasketApi_InstanceCount" Value="-1" /> | |||
<Parameter Name="MarketingApi_InstanceCount" Value="1" /> | |||
<Parameter Name="LocationsApi_InstanceCount" Value="1" /> | |||
<Parameter Name="PaymentApi_InstanceCount" Value="1" /> | |||
<Parameter Name="OrderingApi_InstanceCount" Value="1" /> | |||
<Parameter Name="CatalogApi_InstanceCount" Value="1" /> | |||
<Parameter Name="BasketApi_InstanceCount" Value="1" /> | |||
<Parameter Name="IdentityUrlExternal" Value="http://#{your_sf_dns}#:5105" /> | |||
<Parameter Name="PicBaseUrl" Value="http://#{your_sf_dns}#:5101/api/v1/catalog/items/[0]/pic/" /> | |||
<Parameter Name="PicBaseUrlCatalog" Value="http://#{your_sf_dns}#:5101/api/v1/catalog/items/[0]/pic/" /> | |||
<Parameter Name="PicBaseUrlMarketing" Value="http://#{your_sf_dns}#:5110/api/v1/campaigns/[0]/pic/" /> | |||
<Parameter Name="InstrumentationKey" Value="" /> | |||
</Parameters> | |||
</Application> |
@ -1,7 +1,7 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<Application Name="fabric:/eShopOnServiceFabricWebMVC" xmlns="http://schemas.microsoft.com/2011/01/fabric" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |||
<Parameters> | |||
<Parameter Name="WebMVC_InstanceCount" Value="-1" /> | |||
<Parameter Name="WebMVC_InstanceCount" Value="1" /> | |||
<Parameter Name="IdentityUrl" Value="http://#{your_sf_dns}#:5105" /> | |||
<Parameter Name="InstrumentationKey" Value="" /> | |||
</Parameters> |
@ -1,7 +1,7 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<Application Name="fabric:/eShopOnServiceFabricWebStatus" xmlns="http://schemas.microsoft.com/2011/01/fabric" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |||
<Parameters> | |||
<Parameter Name="WebStatus_InstanceCount" Value="-1" /> | |||
<Parameter Name="WebStatus_InstanceCount" Value="1" /> | |||
<Parameter Name="InstrumentationKey" Value="" /> | |||
</Parameters> | |||
</Application> |
@ -0,0 +1,79 @@ | |||
using Microsoft.AspNetCore.Http; | |||
using Microsoft.Extensions.Primitives; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Security.Claims; | |||
using System.Threading.Tasks; | |||
namespace Basket.API.Infrastructure.Middlewares | |||
{ | |||
class ByPassAuthMiddleware | |||
{ | |||
private readonly RequestDelegate _next; | |||
private string _currentUserId; | |||
public ByPassAuthMiddleware(RequestDelegate next) | |||
{ | |||
_next = next; | |||
_currentUserId = null; | |||
} | |||
public async Task Invoke(HttpContext context) | |||
{ | |||
var path = context.Request.Path; | |||
if (path == "/noauth") | |||
{ | |||
var userid = context.Request.Query["userid"]; | |||
if (!string.IsNullOrEmpty(userid)) | |||
{ | |||
_currentUserId = userid; | |||
} | |||
context.Response.StatusCode = 200; | |||
context.Response.ContentType = "text/string"; | |||
await context.Response.WriteAsync($"User set to {_currentUserId}"); | |||
} | |||
else if (path == "/noauth/reset") | |||
{ | |||
_currentUserId = null; | |||
context.Response.StatusCode = 200; | |||
context.Response.ContentType = "text/string"; | |||
await context.Response.WriteAsync($"User set to none. Token required for protected endpoints."); | |||
} | |||
else | |||
{ | |||
var currentUserId = _currentUserId; | |||
var authHeader = context.Request.Headers["Authorization"]; | |||
if (authHeader != StringValues.Empty) | |||
{ | |||
var header = authHeader.FirstOrDefault(); | |||
if (!string.IsNullOrEmpty(header) && header.StartsWith("Email ") && header.Length > "Email ".Length) | |||
{ | |||
currentUserId = header.Substring("Email ".Length); | |||
} | |||
} | |||
if (!string.IsNullOrEmpty(currentUserId)) | |||
{ | |||
var user = new ClaimsIdentity(new[] { | |||
new Claim("emails", currentUserId), | |||
new Claim("name", "Test user"), | |||
new Claim("nonce", Guid.NewGuid().ToString()), | |||
new Claim("ttp://schemas.microsoft.com/identity/claims/identityprovider", "ByPassAuthMiddleware"), | |||
new Claim("nonce", Guid.NewGuid().ToString()), | |||
new Claim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname","User"), | |||
new Claim("sub", "1234"), | |||
new Claim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname","Microsoft")} | |||
, "ByPassAuth"); | |||
context.User = new ClaimsPrincipal(user); | |||
} | |||
await _next.Invoke(context); | |||
} | |||
} | |||
} | |||
} |
@ -0,0 +1,79 @@ | |||
using Microsoft.AspNetCore.Http; | |||
using Microsoft.Extensions.Primitives; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Security.Claims; | |||
using System.Threading.Tasks; | |||
namespace Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Middlewares | |||
{ | |||
class ByPassAuthMiddleware | |||
{ | |||
private readonly RequestDelegate _next; | |||
private string _currentUserId; | |||
public ByPassAuthMiddleware(RequestDelegate next) | |||
{ | |||
_next = next; | |||
_currentUserId = null; | |||
} | |||
public async Task Invoke(HttpContext context) | |||
{ | |||
var path = context.Request.Path; | |||
if (path == "/noauth") | |||
{ | |||
var userid = context.Request.Query["userid"]; | |||
if (!string.IsNullOrEmpty(userid)) | |||
{ | |||
_currentUserId = userid; | |||
} | |||
context.Response.StatusCode = 200; | |||
context.Response.ContentType = "text/string"; | |||
await context.Response.WriteAsync($"User set to {_currentUserId}"); | |||
} | |||
else if (path == "/noauth/reset") | |||
{ | |||
_currentUserId = null; | |||
context.Response.StatusCode = 200; | |||
context.Response.ContentType = "text/string"; | |||
await context.Response.WriteAsync($"User set to none. Token required for protected endpoints."); | |||
} | |||
else | |||
{ | |||
var currentUserId = _currentUserId; | |||
var authHeader = context.Request.Headers["Authorization"]; | |||
if (authHeader != StringValues.Empty) | |||
{ | |||
var header = authHeader.FirstOrDefault(); | |||
if (!string.IsNullOrEmpty(header) && header.StartsWith("Email ") && header.Length > "Email ".Length) | |||
{ | |||
currentUserId = header.Substring("Email ".Length); | |||
} | |||
} | |||
if (!string.IsNullOrEmpty(currentUserId)) | |||
{ | |||
var user = new ClaimsIdentity(new[] { | |||
new Claim("emails", currentUserId), | |||
new Claim("name", "Test user"), | |||
new Claim("nonce", Guid.NewGuid().ToString()), | |||
new Claim("ttp://schemas.microsoft.com/identity/claims/identityprovider", "ByPassAuthMiddleware"), | |||
new Claim("nonce", Guid.NewGuid().ToString()), | |||
new Claim("sub", "1234"), | |||
new Claim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname","User"), | |||
new Claim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname","Microsoft")} | |||
, "ByPassAuth"); | |||
context.User = new ClaimsPrincipal(user); | |||
} | |||
await _next.Invoke(context); | |||
} | |||
} | |||
} | |||
} |
@ -0,0 +1,79 @@ | |||
using Microsoft.AspNetCore.Http; | |||
using Microsoft.Extensions.Primitives; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Security.Claims; | |||
using System.Threading.Tasks; | |||
namespace Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure.Middlewares | |||
{ | |||
class ByPassAuthMiddleware | |||
{ | |||
private readonly RequestDelegate _next; | |||
private string _currentUserId; | |||
public ByPassAuthMiddleware(RequestDelegate next) | |||
{ | |||
_next = next; | |||
_currentUserId = null; | |||
} | |||
public async Task Invoke(HttpContext context) | |||
{ | |||
var path = context.Request.Path; | |||
if (path == "/noauth") | |||
{ | |||
var userid = context.Request.Query["userid"]; | |||
if (!string.IsNullOrEmpty(userid)) | |||
{ | |||
_currentUserId = userid; | |||
} | |||
context.Response.StatusCode = 200; | |||
context.Response.ContentType = "text/string"; | |||
await context.Response.WriteAsync($"User set to {_currentUserId}"); | |||
} | |||
else if (path == "/noauth/reset") | |||
{ | |||
_currentUserId = null; | |||
context.Response.StatusCode = 200; | |||
context.Response.ContentType = "text/string"; | |||
await context.Response.WriteAsync($"User set to none. Token required for protected endpoints."); | |||
} | |||
else | |||
{ | |||
var currentUserId = _currentUserId; | |||
var authHeader = context.Request.Headers["Authorization"]; | |||
if (authHeader != StringValues.Empty) | |||
{ | |||
var header = authHeader.FirstOrDefault(); | |||
if (!string.IsNullOrEmpty(header) && header.StartsWith("Email ") && header.Length > "Email ".Length) | |||
{ | |||
currentUserId = header.Substring("Email ".Length); | |||
} | |||
} | |||
if (!string.IsNullOrEmpty(currentUserId)) | |||
{ | |||
var user = new ClaimsIdentity(new[] { | |||
new Claim("emails", currentUserId), | |||
new Claim("name", "Test user"), | |||
new Claim("nonce", Guid.NewGuid().ToString()), | |||
new Claim("ttp://schemas.microsoft.com/identity/claims/identityprovider", "ByPassAuthMiddleware"), | |||
new Claim("nonce", Guid.NewGuid().ToString()), | |||
new Claim("sub", "1234"), | |||
new Claim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname","User"), | |||
new Claim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname","Microsoft")} | |||
, "ByPassAuth"); | |||
context.User = new ClaimsPrincipal(user); | |||
} | |||
await _next.Invoke(context); | |||
} | |||
} | |||
} | |||
} |
@ -0,0 +1,79 @@ | |||
using Microsoft.AspNetCore.Http; | |||
using Microsoft.Extensions.Primitives; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Security.Claims; | |||
using System.Threading.Tasks; | |||
namespace Ordering.API.Infrastructure.Middlewares | |||
{ | |||
class ByPassAuthMiddleware | |||
{ | |||
private readonly RequestDelegate _next; | |||
private string _currentUserId; | |||
public ByPassAuthMiddleware(RequestDelegate next) | |||
{ | |||
_next = next; | |||
_currentUserId = null; | |||
} | |||
public async Task Invoke(HttpContext context) | |||
{ | |||
var path = context.Request.Path; | |||
if (path == "/noauth") | |||
{ | |||
var userid = context.Request.Query["userid"]; | |||
if (!string.IsNullOrEmpty(userid)) | |||
{ | |||
_currentUserId = userid; | |||
} | |||
context.Response.StatusCode = 200; | |||
context.Response.ContentType = "text/string"; | |||
await context.Response.WriteAsync($"User set to {_currentUserId}"); | |||
} | |||
else if (path == "/noauth/reset") | |||
{ | |||
_currentUserId = null; | |||
context.Response.StatusCode = 200; | |||
context.Response.ContentType = "text/string"; | |||
await context.Response.WriteAsync($"User set to none. Token required for protected endpoints."); | |||
} | |||
else | |||
{ | |||
var currentUserId = _currentUserId; | |||
var authHeader = context.Request.Headers["Authorization"]; | |||
if (authHeader != StringValues.Empty) | |||
{ | |||
var header = authHeader.FirstOrDefault(); | |||
if (!string.IsNullOrEmpty(header) && header.StartsWith("Email ") && header.Length > "Email ".Length) | |||
{ | |||
currentUserId = header.Substring("Email ".Length); | |||
} | |||
} | |||
if (!string.IsNullOrEmpty(currentUserId)) | |||
{ | |||
var user = new ClaimsIdentity(new[] { | |||
new Claim("emails", currentUserId), | |||
new Claim("name", "Test user"), | |||
new Claim("nonce", Guid.NewGuid().ToString()), | |||
new Claim("ttp://schemas.microsoft.com/identity/claims/identityprovider", "ByPassAuthMiddleware"), | |||
new Claim("nonce", Guid.NewGuid().ToString()), | |||
new Claim("sub", "1234"), | |||
new Claim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname","User"), | |||
new Claim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname","Microsoft")} | |||
, "ByPassAuth"); | |||
context.User = new ClaimsPrincipal(user); | |||
} | |||
await _next.Invoke(context); | |||
} | |||
} | |||
} | |||
} |
@ -0,0 +1,80 @@ | |||
using Microsoft.AspNetCore.Http; | |||
using Microsoft.Extensions.Primitives; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Security.Claims; | |||
using System.Threading.Tasks; | |||
namespace WebMVC.Infrastructure.Middlewares | |||
{ | |||
class ByPassAuthMiddleware | |||
{ | |||
private readonly RequestDelegate _next; | |||
private string _currentUserId; | |||
public ByPassAuthMiddleware(RequestDelegate next) | |||
{ | |||
_next = next; | |||
_currentUserId = null; | |||
} | |||
public async Task Invoke(HttpContext context) | |||
{ | |||
var path = context.Request.Path; | |||
if (path == "/noauth") | |||
{ | |||
var userid = context.Request.Query["userid"]; | |||
if (!string.IsNullOrEmpty(userid)) | |||
{ | |||
_currentUserId = userid; | |||
} | |||
context.Response.StatusCode = 200; | |||
context.Response.ContentType = "text/string"; | |||
await context.Response.WriteAsync($"User set to {_currentUserId}"); | |||
} | |||
else if (path == "/noauth/reset") | |||
{ | |||
_currentUserId = null; | |||
context.Response.StatusCode = 200; | |||
context.Response.ContentType = "text/string"; | |||
await context.Response.WriteAsync($"User set to none. Token required for protected endpoints."); | |||
} | |||
else | |||
{ | |||
var currentUserId = _currentUserId; | |||
var authHeader = context.Request.Headers["Authorization"]; | |||
if (authHeader != StringValues.Empty) | |||
{ | |||
var header = authHeader.FirstOrDefault(); | |||
if (!string.IsNullOrEmpty(header) && header.StartsWith("Email ") && header.Length > "Email ".Length) | |||
{ | |||
currentUserId = header.Substring("Email ".Length); | |||
} | |||
} | |||
if (!string.IsNullOrEmpty(currentUserId)) | |||
{ | |||
var user = new ClaimsIdentity(new[] { | |||
new Claim("emails", currentUserId), | |||
new Claim("name", "Test user"), | |||
new Claim("nonce", Guid.NewGuid().ToString()), | |||
new Claim("ttp://schemas.microsoft.com/identity/claims/identityprovider", "ByPassAuthMiddleware"), | |||
new Claim("nonce", Guid.NewGuid().ToString()), | |||
new Claim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname","User"), | |||
new Claim("sub", "1234"), | |||
new Claim("card_expiration", "12/20"), | |||
new Claim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname","Microsoft")} | |||
, "ByPassAuth"); | |||
context.User = new ClaimsPrincipal(user); | |||
} | |||
await _next.Invoke(context); | |||
} | |||
} | |||
} | |||
} |
@ -0,0 +1,16 @@ | |||
{ | |||
"Logging": { | |||
"IncludeScopes": false, | |||
"LogLevel": { | |||
"Default": "Debug", | |||
"System": "Information", | |||
"Microsoft": "Information" | |||
} | |||
}, | |||
"IdentityUrl": "http://localhost:5105", | |||
"ConnectionString": "127.0.0.1", | |||
"isTest": "true", | |||
"EventBusConnection": "localhost" | |||
} | |||