Allow DpapiNGXmlEncryptor to get the current identity's SID on CoreCLR.
This commit is contained in:
parent
8fc3607a68
commit
ca95189a3b
|
|
@ -4,15 +4,12 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Security.Principal;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
using Microsoft.AspNet.Security.DataProtection.Cng;
|
using Microsoft.AspNet.Security.DataProtection.Cng;
|
||||||
using Microsoft.AspNet.Security.DataProtection.KeyManagement;
|
using Microsoft.AspNet.Security.DataProtection.KeyManagement;
|
||||||
using Microsoft.AspNet.Security.DataProtection.SafeHandles;
|
using Microsoft.AspNet.Security.DataProtection.SafeHandles;
|
||||||
|
|
||||||
#if !ASPNETCORE50
|
|
||||||
using System.Security.Principal;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace Microsoft.AspNet.Security.DataProtection.XmlEncryption
|
namespace Microsoft.AspNet.Security.DataProtection.XmlEncryption
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -79,7 +76,6 @@ namespace Microsoft.AspNet.Security.DataProtection.XmlEncryption
|
||||||
|
|
||||||
private static string GetDefaultProtectionDescriptorString()
|
private static string GetDefaultProtectionDescriptorString()
|
||||||
{
|
{
|
||||||
#if !ASPNETCORE50
|
|
||||||
// Creates a SID=... protection descriptor string for the current user.
|
// Creates a SID=... protection descriptor string for the current user.
|
||||||
// Reminder: DPAPI:NG provides only encryption, not authentication.
|
// Reminder: DPAPI:NG provides only encryption, not authentication.
|
||||||
using (WindowsIdentity currentIdentity = WindowsIdentity.GetCurrent())
|
using (WindowsIdentity currentIdentity = WindowsIdentity.GetCurrent())
|
||||||
|
|
@ -87,9 +83,6 @@ namespace Microsoft.AspNet.Security.DataProtection.XmlEncryption
|
||||||
// use the SID to create an SDDL string
|
// use the SID to create an SDDL string
|
||||||
return String.Format(CultureInfo.InvariantCulture, "SID={0}", currentIdentity.User.Value);
|
return String.Format(CultureInfo.InvariantCulture, "SID={0}", currentIdentity.User.Value);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
throw new NotImplementedException("TODO: Doesn't yet work on Core CLR.");
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@
|
||||||
"System.Security.Cryptography.Encryption.Aes": "4.0.0-beta-*",
|
"System.Security.Cryptography.Encryption.Aes": "4.0.0-beta-*",
|
||||||
"System.Security.Cryptography.Hashing.Algorithms": "4.0.0-beta-*",
|
"System.Security.Cryptography.Hashing.Algorithms": "4.0.0-beta-*",
|
||||||
"System.Security.Cryptography.RandomNumberGenerator": "4.0.0-beta-*",
|
"System.Security.Cryptography.RandomNumberGenerator": "4.0.0-beta-*",
|
||||||
|
"System.Security.Principal.Windows": "4.0.0-beta-*",
|
||||||
"System.Text.Encoding.Extensions": "4.0.10-beta-*",
|
"System.Text.Encoding.Extensions": "4.0.10-beta-*",
|
||||||
"System.Threading": "4.0.0-beta-*",
|
"System.Threading": "4.0.0-beta-*",
|
||||||
"System.Xml.XDocument": "4.0.0-beta-*"
|
"System.Xml.XDocument": "4.0.0-beta-*"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue