Browse Source

Certificate fix

pull/1/head
Sebastian 10 years ago
parent
commit
a5fd4e2ac9
  1. 15
      src/Squidex/Configurations/Identity/IdentityServices.cs
  2. 9
      src/Squidex/project.json

15
src/Squidex/Configurations/Identity/IdentityServices.cs

@ -7,7 +7,7 @@
// ========================================================================== // ==========================================================================
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.Reflection;
using System.Security.Cryptography.X509Certificates; using System.Security.Cryptography.X509Certificates;
using IdentityServer4.Models; using IdentityServer4.Models;
using IdentityServer4.Stores; using IdentityServer4.Stores;
@ -22,9 +22,18 @@ namespace Squidex.Configurations.Identity
{ {
public static IServiceCollection AddMyIdentityServer(this IServiceCollection services, IHostingEnvironment env) public static IServiceCollection AddMyIdentityServer(this IServiceCollection services, IHostingEnvironment env)
{ {
var certPath = Path.Combine(env.ContentRootPath, "Configurations", "Identity", "Cert", "IdentityCert.pfx"); X509Certificate2 certificate;
var certificate = new X509Certificate2(certPath, "password"); var assemblyName = new AssemblyName("Squidex");
var assemblyRef = Assembly.Load(assemblyName);
using (var certStream = assemblyRef.GetManifestResourceStream("Squidex.Configurations.Identity.Cert.IdentityCert.pfx"))
{
var certData = new byte[certStream.Length];
certStream.Read(certData, 0, certData.Length);
certificate = new X509Certificate2(certData, "password");
}
services.AddSingleton( services.AddSingleton(
GetScopes()); GetScopes());

9
src/Squidex/project.json

@ -55,8 +55,13 @@
"buildOptions": { "buildOptions": {
"emitEntryPoint": true, "emitEntryPoint": true,
"preserveCompilationContext": true, "preserveCompilationContext": true,
"xmlDoc": true, "xmlDoc": false,
"nowarn": [ "1591", "1573", "1572" ] "nowarn": [ "1591", "1573", "1572" ],
"embed": {
"include": [
"Configurations/Identity/Cert/*.*"
]
}
}, },
"runtimeOptions": { "runtimeOptions": {

Loading…
Cancel
Save