Merge pull request #1562 from borjasanes/feature/delete-load-test-references
remove load test references
This commit is contained in:
commit
a60152c16a
@ -12,7 +12,6 @@ metadata:
|
||||
data:
|
||||
basket__ConnectionString: {{ .Values.inf.redis.basket.constr }}
|
||||
urls__IdentityUrl: http://{{ .Values.app.svc.identity }}
|
||||
basket__EnableLoadTest: "{{ .Values.inf.misc.useLoadTest }}"
|
||||
all__EventBusConnection: {{ .Values.inf.eventbus.constr }}
|
||||
all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}"
|
||||
all__UseAzureServiceBus: "{{ .Values.inf.eventbus.useAzure }}"
|
@ -36,8 +36,6 @@ env:
|
||||
key: all__UseAzureServiceBus
|
||||
- name: IdentityUrl
|
||||
key: urls__IdentityUrl
|
||||
- name: UseLoadTest
|
||||
key: basket__EnableLoadTest
|
||||
# values define environment variables with a fixed value (no configmap involved) (name is name of var, and value is its value)
|
||||
values:
|
||||
- name: OrchestratorType
|
||||
|
@ -38,7 +38,6 @@ inf:
|
||||
dns: "" # k8s external DNS. This value or ip value MUST BE PROVIDED
|
||||
local: false # True when deploying on "local K8s" provided by Docker Desktop.
|
||||
misc: # inf.misc contains miscellaneous configuration related to infrastructure
|
||||
useLoadTest: false # If running under loading test or not
|
||||
useAzureStorage: false # If catalog api uses azure storage or not
|
||||
# registry: # Uncomment "registry" to specify registry secret
|
||||
# secretName: # secretName is the name of the secret inside k8s
|
||||
|
@ -11,7 +11,6 @@ metadata:
|
||||
heritage: {{ .Release.Service }}
|
||||
data:
|
||||
all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}"
|
||||
all_EnableLoadTest: "{{ .Values.inf.misc.useLoadTest }}"
|
||||
mobileshoppingagg__keystore: {{ .Values.inf.redis.keystore.constr }}
|
||||
internalurls__basket: http://{{ .Values.app.svc.basket }}
|
||||
internalurls__catalog: http://{{ .Values.app.svc.catalog }}
|
||||
|
@ -12,7 +12,6 @@ metadata:
|
||||
heritage: {{ .Release.Service }}
|
||||
data:
|
||||
ordering__ConnectionString: Server={{ $sqlsrv }};Initial Catalog={{ .Values.inf.sql.ordering.db }};User Id={{ .Values.inf.sql.common.user }};Password={{ .Values.inf.sql.common.pwd }};
|
||||
ordering__EnableLoadTest: "{{ .Values.inf.misc.useLoadTest }}"
|
||||
urls__IdentityUrl: http://{{ .Values.app.svc.identity }}
|
||||
all__EventBusConnection: {{ .Values.inf.eventbus.constr }}
|
||||
all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}"
|
||||
|
@ -41,8 +41,6 @@ env:
|
||||
key: all__EventBusConnection
|
||||
- name: AzureServiceBusEnabled
|
||||
key: all__UseAzureServiceBus
|
||||
- name: UseLoadTest
|
||||
key: ordering__EnableLoadTest
|
||||
- name: IdentityUrl
|
||||
key: urls__IdentityUrl
|
||||
# values define environment variables with a fixed value (no configmap involved) (name is name of var, and value is its value)
|
||||
|
@ -13,7 +13,6 @@ metadata:
|
||||
heritage: {{ .Release.Service }}
|
||||
data:
|
||||
ordering__ConnectionString: Server={{ $sqlsrv }};Initial Catalog={{ .Values.inf.sql.ordering.db }};User Id={{ .Values.inf.sql.common.user }};Password={{ .Values.inf.sql.common.pwd }};
|
||||
ordering__EnableLoadTest: "{{ .Values.inf.misc.useLoadTest }}"
|
||||
all__EventBusConnection: {{ .Values.inf.eventbus.constr }}
|
||||
all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}"
|
||||
all__UseAzureServiceBus: "{{ .Values.inf.eventbus.useAzure }}"
|
||||
|
@ -44,8 +44,6 @@ env:
|
||||
key: all__EventBusConnection
|
||||
- name: AzureServiceBusEnabled
|
||||
key: all__UseAzureServiceBus
|
||||
- name: UseLoadTest
|
||||
key: ordering__EnableLoadTest
|
||||
- name: CheckUpdateTime
|
||||
key: graceperiodmanager__CheckUpdateTime
|
||||
- name: GracePeriodTime
|
||||
|
@ -16,7 +16,6 @@ metadata:
|
||||
data:
|
||||
all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}"
|
||||
all__UseAzureServiceBus: "{{ .Values.inf.eventbus.useAzure }}"
|
||||
all_EnableLoadTest: "{{ .Values.inf.misc.useLoadTest }}"
|
||||
webmvc__keystore: {{ .Values.inf.redis.keystore.constr }}
|
||||
internalurls__apigwws: http://{{ .Values.app.svc.webshoppingapigw }}
|
||||
internalurls__identity__hc: http://{{ .Values.app.svc.identity }}/hc
|
||||
|
@ -32,8 +32,6 @@ env:
|
||||
configmap:
|
||||
- name: ApplicationInsights__InstrumentationKey
|
||||
key: all__InstrumentationKey
|
||||
- name: UseLoadTest
|
||||
key: all_EnableLoadTest
|
||||
- name: DPConnectionString
|
||||
key: webmvc__keystore
|
||||
- name: PurchaseUrl
|
||||
|
@ -11,7 +11,6 @@ metadata:
|
||||
heritage: {{ .Release.Service }}
|
||||
data:
|
||||
all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}"
|
||||
all_EnableLoadTest: "{{ .Values.inf.misc.useLoadTest }}"
|
||||
webshoppingagg__keystore: {{ .Values.inf.redis.keystore.constr }}
|
||||
internalurls__basket: http://{{ .Values.app.svc.basket }}
|
||||
internalurls__catalog: http://{{ .Values.app.svc.catalog }}
|
||||
|
@ -32,8 +32,6 @@ env:
|
||||
configmap:
|
||||
- name: ApplicationInsights__InstrumentationKey
|
||||
key: all__InstrumentationKey
|
||||
- name: UseLoadTest
|
||||
key: all_EnableLoadTest
|
||||
- name: DPConnectionString
|
||||
key: webspa__keystore
|
||||
- name: PurchaseUrl
|
||||
|
@ -12,7 +12,6 @@ metadata:
|
||||
data:
|
||||
basket__ConnectionString: {{ .Values.inf.redis.basket.constr }}
|
||||
urls__IdentityUrl: http://{{ .Values.app.svc.identity }}
|
||||
basket__EnableLoadTest: "{{ .Values.inf.misc.useLoadTest }}"
|
||||
all__EventBusConnection: {{ .Values.inf.eventbus.constr }}
|
||||
all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}"
|
||||
all__UseAzureServiceBus: "{{ .Values.inf.eventbus.useAzure }}"
|
@ -36,8 +36,6 @@ env:
|
||||
key: all__UseAzureServiceBus
|
||||
- name: IdentityUrl
|
||||
key: urls__IdentityUrl
|
||||
- name: UseLoadTest
|
||||
key: basket__EnableLoadTest
|
||||
# values define environment variables with a fixed value (no configmap involved) (name is name of var, and value is its value)
|
||||
values:
|
||||
- name: OrchestratorType
|
||||
|
@ -38,7 +38,6 @@ inf:
|
||||
dns: "" # k8s external DNS. This value or ip value MUST BE PROVIDED
|
||||
local: false # True when deploying on "local K8s" provided by Docker Desktop.
|
||||
misc: # inf.misc contains miscellaneous configuration related to infrastructure
|
||||
useLoadTest: false # If running under loading test or not
|
||||
useAzureStorage: false # If catalog api uses azure storage or not
|
||||
# registry: # Uncomment "registry" to specify registry secret
|
||||
# secretName: # secretName is the name of the secret inside k8s
|
||||
|
@ -11,7 +11,6 @@ metadata:
|
||||
heritage: {{ .Release.Service }}
|
||||
data:
|
||||
all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}"
|
||||
all_EnableLoadTest: "{{ .Values.inf.misc.useLoadTest }}"
|
||||
mobileshoppingagg__keystore: {{ .Values.inf.redis.keystore.constr }}
|
||||
internalurls__basket: http://{{ .Values.app.svc.basket }}
|
||||
internalurls__catalog: http://{{ .Values.app.svc.catalog }}
|
||||
|
@ -12,7 +12,6 @@ metadata:
|
||||
heritage: {{ .Release.Service }}
|
||||
data:
|
||||
ordering__ConnectionString: Server={{ $sqlsrv }};Initial Catalog={{ .Values.inf.sql.ordering.db }};User Id={{ .Values.inf.sql.common.user }};Password={{ .Values.inf.sql.common.pwd }};
|
||||
ordering__EnableLoadTest: "{{ .Values.inf.misc.useLoadTest }}"
|
||||
urls__IdentityUrl: http://{{ .Values.app.svc.identity }}
|
||||
all__EventBusConnection: {{ .Values.inf.eventbus.constr }}
|
||||
all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}"
|
||||
|
@ -41,8 +41,6 @@ env:
|
||||
key: all__EventBusConnection
|
||||
- name: AzureServiceBusEnabled
|
||||
key: all__UseAzureServiceBus
|
||||
- name: UseLoadTest
|
||||
key: ordering__EnableLoadTest
|
||||
- name: IdentityUrl
|
||||
key: urls__IdentityUrl
|
||||
# values define environment variables with a fixed value (no configmap involved) (name is name of var, and value is its value)
|
||||
|
@ -44,8 +44,6 @@ env:
|
||||
key: all__EventBusConnection
|
||||
- name: AzureServiceBusEnabled
|
||||
key: all__UseAzureServiceBus
|
||||
- name: UseLoadTest
|
||||
key: ordering__EnableLoadTest
|
||||
- name: CheckUpdateTime
|
||||
key: graceperiodmanager__CheckUpdateTime
|
||||
- name: GracePeriodTime
|
||||
|
@ -16,7 +16,6 @@ metadata:
|
||||
data:
|
||||
all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}"
|
||||
all__UseAzureServiceBus: "{{ .Values.inf.eventbus.useAzure }}"
|
||||
all_EnableLoadTest: "{{ .Values.inf.misc.useLoadTest }}"
|
||||
webmvc__keystore: {{ .Values.inf.redis.keystore.constr }}
|
||||
internalurls__apigwws: http://{{ .Values.app.svc.webshoppingapigw }}
|
||||
internalurls__identity__hc: http://{{ .Values.app.svc.identity }}/hc
|
||||
|
@ -32,8 +32,6 @@ env:
|
||||
configmap:
|
||||
- name: ApplicationInsights__InstrumentationKey
|
||||
key: all__InstrumentationKey
|
||||
- name: UseLoadTest
|
||||
key: all_EnableLoadTest
|
||||
- name: DPConnectionString
|
||||
key: webmvc__keystore
|
||||
- name: PurchaseUrl
|
||||
|
@ -11,7 +11,6 @@ metadata:
|
||||
heritage: {{ .Release.Service }}
|
||||
data:
|
||||
all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}"
|
||||
all_EnableLoadTest: "{{ .Values.inf.misc.useLoadTest }}"
|
||||
webshoppingagg__keystore: {{ .Values.inf.redis.keystore.constr }}
|
||||
internalurls__basket: http://{{ .Values.app.svc.basket }}
|
||||
internalurls__catalog: http://{{ .Values.app.svc.catalog }}
|
||||
|
@ -16,7 +16,6 @@ metadata:
|
||||
heritage: {{ .Release.Service }}
|
||||
data:
|
||||
all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}"
|
||||
all_EnableLoadTest: "{{ .Values.inf.misc.useLoadTest }}"
|
||||
webspa__keystore: {{ .Values.inf.redis.keystore.constr }}
|
||||
internalurls__apigwws: http://{{ .Values.app.svc.webshoppingapigw }}
|
||||
internalurls__identity__hc: http://{{ .Values.app.svc.identity }}/hc
|
||||
|
@ -32,8 +32,6 @@ env:
|
||||
configmap:
|
||||
- name: ApplicationInsights__InstrumentationKey
|
||||
key: all__InstrumentationKey
|
||||
- name: UseLoadTest
|
||||
key: all_EnableLoadTest
|
||||
- name: DPConnectionString
|
||||
key: webspa__keystore
|
||||
- name: PurchaseUrl
|
||||
|
@ -16,7 +16,6 @@ metadata:
|
||||
data:
|
||||
all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}"
|
||||
all__UseAzureServiceBus: "{{ .Values.inf.eventbus.useAzure }}"
|
||||
all_EnableLoadTest: "{{ .Values.inf.misc.useLoadTest }}"
|
||||
webstatus__keystore: {{ .Values.inf.redis.keystore.constr }}
|
||||
name__mvc__hc: WebMVC HTTP Check
|
||||
internalurls__mvc__hc: http://{{ .Values.app.svc.mvc }}/hc
|
||||
|
3
src/.env
3
src/.env
@ -32,5 +32,4 @@ ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP=10.121.122.162
|
||||
#ESHOP_AZURE_STORAGE_CATALOG_KEY=<YourAzureStorageCatalogKey>
|
||||
#ESHOP_SERVICE_BUS_USERNAME=<ServiceBusUserName-OnlyUsedIfUsingRabbitMQUnderwindows>
|
||||
#ESHOP_SERVICE_BUS_PASSWORD=<ServiceBusUserPassword-OnlyUsedIfUsingRabbitMQUnderwindows>
|
||||
#INSTRUMENTATION_KEY=
|
||||
#USE_LOADTEST=<True/False>
|
||||
#INSTRUMENTATION_KEY=
|
@ -1,79 +0,0 @@
|
||||
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("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name", "Test user"),
|
||||
new Claim("nonce", Guid.NewGuid().ToString()),
|
||||
new Claim("http://schemas.microsoft.com/identity/claims/identityprovider", "ByPassAuthMiddleware"),
|
||||
new Claim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname","User"),
|
||||
new Claim("sub", currentUserId),
|
||||
new Claim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname","Microsoft")}
|
||||
, "ByPassAuth");
|
||||
|
||||
context.User = new ClaimsPrincipal(user);
|
||||
}
|
||||
|
||||
await _next.Invoke(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -275,11 +275,6 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
|
||||
|
||||
protected virtual void ConfigureAuth(IApplicationBuilder app)
|
||||
{
|
||||
if (Configuration.GetValue<bool>("UseLoadTest"))
|
||||
{
|
||||
app.UseMiddleware<ByPassAuthMiddleware>();
|
||||
}
|
||||
|
||||
app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
}
|
||||
|
@ -1,79 +0,0 @@
|
||||
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("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name", "Test user"),
|
||||
new Claim("nonce", Guid.NewGuid().ToString()),
|
||||
new Claim("http://schemas.microsoft.com/identity/claims/identityprovider", "ByPassAuthMiddleware"),
|
||||
new Claim("sub", currentUserId),
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -6,7 +6,6 @@
|
||||
using global::Ordering.API.Application.IntegrationEvents;
|
||||
using global::Ordering.API.Application.IntegrationEvents.Events;
|
||||
using global::Ordering.API.Infrastructure.Filters;
|
||||
using global::Ordering.API.Infrastructure.Middlewares;
|
||||
using GrpcOrdering;
|
||||
using HealthChecks.UI.Client;
|
||||
using Infrastructure.AutofacModules;
|
||||
@ -149,11 +148,6 @@
|
||||
|
||||
protected virtual void ConfigureAuth(IApplicationBuilder app)
|
||||
{
|
||||
if (Configuration.GetValue<bool>("UseLoadTest"))
|
||||
{
|
||||
app.UseMiddleware<ByPassAuthMiddleware>();
|
||||
}
|
||||
|
||||
app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
}
|
||||
|
@ -112,13 +112,6 @@ namespace Webhooks.API
|
||||
|
||||
protected virtual void ConfigureAuth(IApplicationBuilder app)
|
||||
{
|
||||
/*
|
||||
if (Configuration.GetValue<bool>("UseLoadTest"))
|
||||
{
|
||||
app.UseMiddleware<ByPassAuthMiddleware>();
|
||||
}
|
||||
*/
|
||||
|
||||
app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
}
|
||||
|
@ -1,80 +0,0 @@
|
||||
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("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name", "Test user"),
|
||||
new Claim("http://schemas.microsoft.com/identity/claims/identityprovider", "ByPassAuthMiddleware"),
|
||||
new Claim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname","User"),
|
||||
new Claim("sub", currentUserId),
|
||||
new Claim("card_expiration", "12/21"),
|
||||
new Claim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname","Microsoft")}
|
||||
, "ByPassAuth");
|
||||
|
||||
context.User = new ClaimsPrincipal(user);
|
||||
}
|
||||
|
||||
await _next.Invoke(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -18,7 +18,6 @@ using StackExchange.Redis;
|
||||
using System;
|
||||
using System.IdentityModel.Tokens.Jwt;
|
||||
using WebMVC.Infrastructure;
|
||||
using WebMVC.Infrastructure.Middlewares;
|
||||
using WebMVC.Services;
|
||||
|
||||
namespace Microsoft.eShopOnContainers.WebMVC
|
||||
@ -73,11 +72,6 @@ namespace Microsoft.eShopOnContainers.WebMVC
|
||||
app.UseStaticFiles();
|
||||
app.UseSession();
|
||||
|
||||
if (Configuration.GetValue<bool>("UseLoadTest"))
|
||||
{
|
||||
app.UseMiddleware<ByPassAuthMiddleware>();
|
||||
}
|
||||
|
||||
WebContextSeed.Seed(app, env);
|
||||
|
||||
// Fix samesite issue when running eShop from docker-compose locally as by default http protocol is being used
|
||||
@ -182,7 +176,6 @@ namespace Microsoft.eShopOnContainers.WebMVC
|
||||
|
||||
public static IServiceCollection AddCustomAuthentication(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
var useLoadTest = configuration.GetValue<bool>("UseLoadTest");
|
||||
var identityUrl = configuration.GetValue<string>("IdentityUrl");
|
||||
var callBackUrl = configuration.GetValue<string>("CallBackUrl");
|
||||
var sessionCookieLifetime = configuration.GetValue("SessionCookieLifetimeMinutes", 60);
|
||||
@ -200,9 +193,9 @@ namespace Microsoft.eShopOnContainers.WebMVC
|
||||
options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
|
||||
options.Authority = identityUrl.ToString();
|
||||
options.SignedOutRedirectUri = callBackUrl.ToString();
|
||||
options.ClientId = useLoadTest ? "mvctest" : "mvc";
|
||||
options.ClientId = "mvc";
|
||||
options.ClientSecret = "secret";
|
||||
options.ResponseType = useLoadTest ? "code id_token token" : "code id_token";
|
||||
options.ResponseType = "code id_token";
|
||||
options.SaveTokens = true;
|
||||
options.GetClaimsFromUserInfoEndpoint = true;
|
||||
options.RequireHttpsMetadata = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user