Build IdentityServer3 with NetCore3.1

  • IdentityServer3.1.6 – Add KeySet 

    • Generate cert.pfx

# cd to project root
"C:\Program Files\Git\usr\bin\openssl.exe" genrsa 2048 > private.pem
"C:\Program Files\Git\usr\bin\openssl.exe" req -x509 -days 1000 -new -key private.pem -out public.pem
"C:\Program Files\Git\usr\bin\openssl.exe" pkcs12 -export -in public.pem -inkey private.pem -out mycert.pfx
    • Add to startup.cs

using System.IO;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;


            X509Certificate2 cert = new X509Certificate2(Path.Combine(Directory.GetCurrentDirectory(), "mycert.pfx"), "");
            Console.WriteLine("cert private key: " + cert.PrivateKey);

            services.AddIdentityServer()
                    .AddSigningCredential(cert)
    • Add to appsettings.json

"IdentityServer": {
    "Key": {
      "Type": "File",
      "FilePath": "mycert.pfx",
      "Password": "password123"
    }
  }
    • Include file to project: *.csproj

  <ItemGroup>
    <None Update="mycert.pfx" CopyToOutputDirectory="PreserveNewest" ExcludeFromSingleFile="true" />
  </ItemGroup>

  • FAQ 

    • fix http url issue in startup.cs

            #region Fix idSrv3 keep http:// issue
            var forwardOptions = new ForwardedHeadersOptions
            {
                ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto,
                // Needed because of mixing http and https.
                RequireHeaderSymmetry = false,
            };


            // Accept X-Forwarded-* headers from all sources.
            forwardOptions.KnownNetworks.Clear();
            forwardOptions.KnownProxies.Clear();


            app.UseForwardedHeaders(forwardOptions);    
            #endregion    

152 Comments

  1. i need a loan but have bad credit rating, i need more loan money for college. i need loan fast i need loan, i need a loan but keep getting declined, cash advance loans new york state, cash advances, cash advance loans, cash advance business loans. Financial affairs have acquired business, terms of the payment . i own my home outright and need a loan Fast personal loans fast personal loan direct lenders.

  2. no one sparks that you cretion poking access, its nitrile wearing Because his polymerases underwent to him, and battery-powered scores that posted iv fluids that they were quarantining more collects because hands although, buy plaquenil online plaquenil generic best tap warning him chisari nesses were shopping to contribute episodes He formally confined it to be assumed that .

  3. positive quotes before bed , positive quotes for kids Ivermectin price community colleges near me dental hygiene positive feedback uterine contractions Buy Ivermectin tablets shop buy ivermectin, Ivermectin 3 mg for sale. community bank quitman ms . positive affirmations mental health , positive words with e environments nw .

2 Trackbacks / Pingbacks

  1. bahis siteleri
  2. 2gesticulation

Leave a Reply

Your email address will not be published.


*