Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix openid certificates on Azure App Services #3255

Merged
merged 2 commits into from
Mar 5, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -497,11 +497,14 @@ private static X509Certificate2 GetCertificate(StoreLocation location, StoreName
X509KeyStorageFlags.EphemeralKeySet :
X509KeyStorageFlags.MachineKeySet;
#else
X509KeyStorageFlags.MachineKeySet;
X509KeyStorageFlags.MachineKeySet |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming you're going to target .NET Core, you'll likely hit the other branch (in the #ifdef). You may want to adopt the same code path for both .NET Standard and .NET Core, assuming we can make it work on every possible environment.

X509KeyStorageFlags.PersistKeySet |
X509KeyStorageFlags.Exportable;
#endif

// Only add the certificate if it's still valid.
var certificate = new X509Certificate2(file.FullName, password, flags);

if (certificate.NotBefore <= DateTime.Now && certificate.NotAfter > DateTime.Now)
{
certificates.Add((file.FullName, certificate));
Expand Down