don't check ssl certs 😬

This commit is contained in:
Muhammad Azeez
2021-01-17 12:14:40 +03:00
parent dac893275a
commit ecbba4c648
3 changed files with 17 additions and 2 deletions

View File

@@ -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 =>