diff --git a/CSharp/OidcSamples/OidcSamples.AuthorizationServer/Startup.cs b/CSharp/OidcSamples/OidcSamples.AuthorizationServer/Startup.cs index b4e3318..ab808a4 100644 --- a/CSharp/OidcSamples/OidcSamples.AuthorizationServer/Startup.cs +++ b/CSharp/OidcSamples/OidcSamples.AuthorizationServer/Startup.cs @@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; +using System.Net; namespace OidcSamples.AuthorizationServer { @@ -23,6 +24,10 @@ namespace OidcSamples.AuthorizationServer { services.AddControllersWithViews(); + // Dirty Hack: Disable verifying SSL certificates 😬 + ServicePointManager.ServerCertificateValidationCallback += + (sender, cert, chain, sslPolicyErrors) => true; + services.AddCors(options => { options.AddPolicy(name: "Default", diff --git a/CSharp/OidcSamples/OidcSamples.TaxApp/Startup.cs b/CSharp/OidcSamples/OidcSamples.TaxApp/Startup.cs index 5c47bc3..263a863 100644 --- a/CSharp/OidcSamples/OidcSamples.TaxApp/Startup.cs +++ b/CSharp/OidcSamples/OidcSamples.TaxApp/Startup.cs @@ -1,4 +1,4 @@ -using Microsoft.AspNetCore.Authentication; +using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.Cookies; using Microsoft.AspNetCore.Authentication.OpenIdConnect; using Microsoft.AspNetCore.Authorization; @@ -14,6 +14,7 @@ using Microsoft.Net.Http.Headers; using System; using System.Collections.Generic; using System.Linq; +using System.Net; using System.Threading.Tasks; namespace OidcSamples.TaxApp @@ -30,6 +31,10 @@ namespace OidcSamples.TaxApp // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { + // Dirty Hack: Disable verifying SSL certificates 😬 + ServicePointManager.ServerCertificateValidationCallback += + (sender, cert, chain, sslPolicyErrors) => true; + services.AddRazorPages(); services.AddControllersWithViews(); diff --git a/CSharp/OidcSamples/OidcSamples.TrafficPoliceApi/Startup.cs b/CSharp/OidcSamples/OidcSamples.TrafficPoliceApi/Startup.cs index e4cd056..42014b1 100644 --- a/CSharp/OidcSamples/OidcSamples.TrafficPoliceApi/Startup.cs +++ b/CSharp/OidcSamples/OidcSamples.TrafficPoliceApi/Startup.cs @@ -1,4 +1,4 @@ -using Microsoft.AspNetCore.Authentication.JwtBearer; +using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; @@ -16,6 +16,7 @@ using System.Collections.Generic; using System.Globalization; using System.IdentityModel.Tokens.Jwt; using System.Linq; +using System.Net; using System.Threading.Tasks; namespace OidcSamples.TrafficPoliceApi @@ -32,6 +33,10 @@ namespace OidcSamples.TrafficPoliceApi // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { + // Dirty Hack: Disable verifying SSL certificates 😬 + ServicePointManager.ServerCertificateValidationCallback += + (sender, cert, chain, sslPolicyErrors) => true; + JwtSecurityTokenHandler.DefaultInboundClaimTypeMap["sub"] = "sub"; services.AddCors(options =>