From fe93901f084c9a5589a0a32b5607088fc1846ae5 Mon Sep 17 00:00:00 2001 From: Erik Pique Date: Tue, 23 Jul 2019 15:23:26 +0200 Subject: [PATCH] identity service --- src/Services/Catalog/Catalog.API/Startup.cs | 11 ----- .../Identity/Identity.API/Identity.API.csproj | 10 ++-- src/Services/Identity/Identity.API/Startup.cs | 31 +++++------- .../Identity.API/Views/Account/Login.cshtml | 5 +- src/Web/WebMVC/Startup.cs | 48 +++++++++---------- src/_build/dependencies.props | 28 ++++++----- 6 files changed, 60 insertions(+), 73 deletions(-) diff --git a/src/Services/Catalog/Catalog.API/Startup.cs b/src/Services/Catalog/Catalog.API/Startup.cs index c34db7614..85fd3ba42 100644 --- a/src/Services/Catalog/Catalog.API/Startup.cs +++ b/src/Services/Catalog/Catalog.API/Startup.cs @@ -75,17 +75,6 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API app.UsePathBase(pathBase); } - app.UseHealthChecks("/hc", new HealthCheckOptions() - { - Predicate = _ => true, - ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse - }); - - app.UseHealthChecks("/liveness", new HealthCheckOptions - { - Predicate = r => r.Name.Contains("self") - }); - app.UseCors("CorsPolicy"); app.UseRouting(); diff --git a/src/Services/Identity/Identity.API/Identity.API.csproj b/src/Services/Identity/Identity.API/Identity.API.csproj index e68e36a7e..6301e21e3 100644 --- a/src/Services/Identity/Identity.API/Identity.API.csproj +++ b/src/Services/Identity/Identity.API/Identity.API.csproj @@ -16,17 +16,17 @@ - - + + - + - + @@ -34,6 +34,8 @@ + + diff --git a/src/Services/Identity/Identity.API/Startup.cs b/src/Services/Identity/Identity.API/Startup.cs index 009773b62..644124da4 100644 --- a/src/Services/Identity/Identity.API/Startup.cs +++ b/src/Services/Identity/Identity.API/Startup.cs @@ -55,7 +55,7 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API services.Configure(Configuration); services.AddMvc() - .SetCompatibilityVersion(CompatibilityVersion.Version_2_2); + .SetCompatibilityVersion(CompatibilityVersion.Version_3_0); if (Configuration.GetValue("IsClusterEnv") == bool.TrueString) { @@ -140,20 +140,8 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API app.UsePathBase(pathBase); } - app.UseHealthChecks("/hc", new HealthCheckOptions() - { - Predicate = _ => true, - ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse - }); - - app.UseHealthChecks("/liveness", new HealthCheckOptions - { - Predicate = r => r.Name.Contains("self") - }); - app.UseStaticFiles(); - // Make work identity server redirections in Edge and lastest versions of browers. WARN: Not valid in a production environment. app.Use(async (context, next) => { @@ -164,13 +152,20 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API app.UseForwardedHeaders(); // Adds IdentityServer app.UseIdentityServer(); - app.UseHttpsRedirection(); - app.UseMvc(routes => + app.UseRouting(); + app.UseEndpoints(endpoints => { - routes.MapRoute( - name: "default", - template: "{controller=Home}/{action=Index}/{id?}"); + endpoints.MapHealthChecks("/hc", new HealthCheckOptions() + { + Predicate = _ => true, + ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse + }); + endpoints.MapHealthChecks("/liveness", new HealthCheckOptions + { + Predicate = r => r.Name.Contains("self") + }); + endpoints.MapDefaultControllerRoute(); }); } diff --git a/src/Services/Identity/Identity.API/Views/Account/Login.cshtml b/src/Services/Identity/Identity.API/Views/Account/Login.cshtml index 315810419..b74d7d8b9 100644 --- a/src/Services/Identity/Identity.API/Views/Account/Login.cshtml +++ b/src/Services/Identity/Identity.API/Views/Account/Login.cshtml @@ -1,7 +1,4 @@ -@using System.Collections.Generic -@using Microsoft.AspNetCore.Http -@using Microsoft.AspNetCore.Http.Authentication -@model Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels.LoginViewModel +@model Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels.LoginViewModel @{ diff --git a/src/Web/WebMVC/Startup.cs b/src/Web/WebMVC/Startup.cs index e9c0a519f..1d2908bf1 100644 --- a/src/Web/WebMVC/Startup.cs +++ b/src/Web/WebMVC/Startup.cs @@ -234,29 +234,29 @@ namespace Microsoft.eShopOnContainers.WebMVC .AddCookie(setup => setup.ExpireTimeSpan = TimeSpan.FromMinutes(sessionCookieLifetime)) .AddJwtBearer(options => { - options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme; + //options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme; + //options.Authority = identityUrl.ToString(); + //options.SignedOutRedirectUri = callBackUrl.ToString(); + //options.ClientId = useLoadTest ? "mvctest" : "mvc"; + //options.ClientSecret = "secret"; + //options.ResponseType = useLoadTest ? "code id_token token" : "code id_token"; + //options.SaveTokens = true; + //options.GetClaimsFromUserInfoEndpoint = true; + //options.RequireHttpsMetadata = false; + //options.Scope.Add("openid"); + //options.Scope.Add("profile"); + //options.Scope.Add("orders"); + //options.Scope.Add("basket"); + //options.Scope.Add("marketing"); + //options.Scope.Add("locations"); + //options.Scope.Add("webshoppingagg"); + //options.Scope.Add("orders.signalrhub"); + + //options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme; options.Authority = identityUrl.ToString(); - options.SignedOutRedirectUri = callBackUrl.ToString(); - options.ClientId = useLoadTest ? "mvctest" : "mvc"; - options.ClientSecret = "secret"; - options.ResponseType = useLoadTest ? "code id_token token" : "code id_token"; - options.SaveTokens = true; - options.GetClaimsFromUserInfoEndpoint = true; - options.RequireHttpsMetadata = false; - options.Scope.Add("openid"); - options.Scope.Add("profile"); - options.Scope.Add("orders"); - options.Scope.Add("basket"); - options.Scope.Add("marketing"); - options.Scope.Add("locations"); - options.Scope.Add("webshoppingagg"); - options.Scope.Add("orders.signalrhub"); - - /*options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme; - options.Authority = identityUrl.ToString(); - options.SignedOutRedirectUri = callBackUrl.ToString(); - options.ClientId = useLoadTest ? "mvctest" : "mvc"; - options.ClientSecret = "secret"; + options.ForwardSignOut = callBackUrl.ToString(); + //options.ClientId = useLoadTest ? "mvctest" : "mvc"; + //options.ClientSecret = "secret"; if (useLoadTest) { @@ -268,7 +268,7 @@ namespace Microsoft.eShopOnContainers.WebMVC } options.SaveToken = true; - options.GetClaimsFromUserInfoEndpoint = true; + //options.GetClaimsFromUserInfoEndpoint = true; options.RequireHttpsMetadata = false; options.Configuration.ScopesSupported.Add("openid"); options.Configuration.ScopesSupported.Add("profile"); @@ -277,7 +277,7 @@ namespace Microsoft.eShopOnContainers.WebMVC options.Configuration.ScopesSupported.Add("marketing"); options.Configuration.ScopesSupported.Add("locations"); options.Configuration.ScopesSupported.Add("webshoppingagg"); - options.Configuration.ScopesSupported.Add("orders.signalrhub");*/ + options.Configuration.ScopesSupported.Add("orders.signalrhub"); }); return services; diff --git a/src/_build/dependencies.props b/src/_build/dependencies.props index 7914c41c7..b914b4ec3 100644 --- a/src/_build/dependencies.props +++ b/src/_build/dependencies.props @@ -15,7 +15,7 @@ 2.9.406 - + 0.1.22-pre1 3.9.0-rc1 1.22.0 @@ -32,24 +32,24 @@ 4.9.2 4.2.1 1.50.7 - 3.0.0-alpha1-10670 - 1.0.2105168 - 3.0.0-preview6-19319-03 - 3.0.0-preview6-19253-01 - 4.3.0 + 4.3.0 4.5.1 4.5.0 5.1.0 2.6.375 - 2.2.0-preview2-35157 - 5.2.7 + 5.2.7 15.9.20 1.0.172 - 3.0.0-alpha1-34847 + 1.0.2105168 + 3.0.0-preview6-19319-03 5.1.0 2.2.1 2.6.1 1.0.2 + 3.0.0-alpha1-10670 + 3.0.0-preview6-19253-01 + 2.2.0-preview2-35157 + 3.0.0-alpha1-34847 3.0.0-preview6.19307.2 3.0.0-preview6.19307.2 2.2.0 @@ -57,11 +57,13 @@ 2.2.0 3.0.0-preview6.19307.2 3.0.0-preview6.19307.2 + 3.0.0-preview6.19307.2 + 3.0.0-preview6-19253-01 + 3.0.0-preview4-19123-01 + 7.5.0 3.0.0 4.5.0 - 3.0.0-preview4-19123-01 4.7.0-preview6.19303.8 - 7.5.0 3.0.0-preview6.19304.10 3.0.0-preview6.19304.10 3.0.0-preview6.19304.10 @@ -82,6 +84,8 @@ 12.0.2 12.0.1 6.0.1 + 3.0.0-preview3.4 + 3.0.0-preview3.4 5.0.1 3.0.0-dev-00053 2.1.3 @@ -94,7 +98,7 @@ 4.3.0 2.4.0 2.4.0 - + https://github.com/dotnet-architecture/eShopOnContainers/blob/master/LICENSE