Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 122cad4

Browse files
JeremyKuhnedanmoseley
authored andcommitted
Add missing IInternalConfigHost method (#27832)
The intital implementation of ConfigurationManager predated the Core impl of Security.
1 parent 7480f25 commit 122cad4

File tree

8 files changed

+33
-6
lines changed

8 files changed

+33
-6
lines changed

src/System.Configuration.ConfigurationManager/ref/System.Configuration.ConfigurationManager.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
<SuppressPackageTargetFrameworkCompatibility Include="$(UAPvNextTFM)" />
1616
<Compile Include="System.Configuration.cs" />
1717
</ItemGroup>
18+
<ItemGroup>
19+
<ProjectReference Include="..\..\System.Security.Permissions\ref\System.Security.Permissions.csproj" />
20+
</ItemGroup>
1821
<ItemGroup Condition="'$(IsPartialFacadeAssembly)' == 'true'">
1922
<Reference Include="mscorlib" />
2023
<Reference Include="System" />

src/System.Configuration.ConfigurationManager/ref/System.Configuration.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,6 +1403,8 @@ public virtual void DeleteStream(string streamName) { }
14031403
public virtual string GetConfigPathFromLocationSubPath(string configPath, string locationSubPath) { throw null; }
14041404
public virtual System.Type GetConfigType(string typeName, bool throwOnError) { throw null; }
14051405
public virtual string GetConfigTypeName(System.Type t) { throw null; }
1406+
public virtual void GetRestrictedPermissions(IInternalConfigRecord configRecord, out System.Security.PermissionSet permissionSet, out bool isHostReady) { throw null; }
1407+
14061408
public virtual string GetStreamName(string configPath) { throw null; }
14071409
public virtual string GetStreamNameForConfigSource(string streamName, string configSource) { throw null; }
14081410
public virtual object GetStreamVersion(string streamName) { throw null; }
@@ -1489,6 +1491,7 @@ public partial interface IInternalConfigHost
14891491
string GetConfigPathFromLocationSubPath(string configPath, string locationSubPath);
14901492
System.Type GetConfigType(string typeName, bool throwOnError);
14911493
string GetConfigTypeName(System.Type t);
1494+
void GetRestrictedPermissions(IInternalConfigRecord configRecord, out System.Security.PermissionSet permissionSet, out bool isHostReady);
14921495
string GetStreamName(string configPath);
14931496
string GetStreamNameForConfigSource(string streamName, string configSource);
14941497
object GetStreamVersion(string streamName);

src/System.Configuration.ConfigurationManager/src/ApiCompatBaseline.netfx.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/System.Configuration.ConfigurationManager/src/System.Configuration.ConfigurationManager.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@
258258
</ItemGroup>
259259
<ItemGroup Condition="'$(IsPartialFacadeAssembly)' != 'true'">
260260
<Reference Include="System.Security.Cryptography.ProtectedData" />
261+
<Reference Include="System.Security.Permissions" />
261262
</ItemGroup>
262263
<ItemGroup>
263264
<EmbeddedResource Include="Resources\$(AssemblyName).rd.xml" />

src/System.Configuration.ConfigurationManager/src/System/Configuration/Internal/DelegatingConfigHost.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// See the LICENSE file in the project root for more information.
44

55
using System.IO;
6+
using System.Security;
67

78
namespace System.Configuration.Internal
89
{
@@ -230,5 +231,11 @@ public virtual void RefreshConfigPaths()
230231
public virtual bool IsFullTrustSectionWithoutAptcaAllowed(IInternalConfigRecord configRecord) => true;
231232

232233
public virtual IDisposable Impersonate() => new DummyDisposable();
234+
235+
public virtual void GetRestrictedPermissions(IInternalConfigRecord configRecord, out PermissionSet permissionSet, out bool isHostReady)
236+
{
237+
permissionSet = new PermissionSet(null);
238+
isHostReady = true;
239+
}
233240
}
234-
}
241+
}

src/System.Configuration.ConfigurationManager/src/System/Configuration/Internal/IInternalConfigHost.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
using System.IO;
66
using System.Runtime.InteropServices;
7+
using System.Security;
78

89
namespace System.Configuration.Internal
910
{
@@ -102,5 +103,7 @@ string EncryptSection(string clearTextXml, ProtectedConfigurationProvider protec
102103
bool IsFullTrustSectionWithoutAptcaAllowed(IInternalConfigRecord configRecord);
103104

104105
IDisposable Impersonate();
106+
107+
void GetRestrictedPermissions(IInternalConfigRecord configRecord, out PermissionSet permissionSet, out bool isHostReady);
105108
}
106-
}
109+
}

src/System.Configuration.ConfigurationManager/src/System/Configuration/Internal/InternalConfigHost.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// See the LICENSE file in the project root for more information.
44

55
using System.IO;
6+
using System.Security;
67

78
namespace System.Configuration.Internal
89
{
@@ -303,5 +304,11 @@ internal static bool StaticIsFile(string streamName)
303304
public bool IsFullTrustSectionWithoutAptcaAllowed(IInternalConfigRecord configRecord) => true;
304305

305306
public IDisposable Impersonate() => new DummyDisposable();
307+
308+
public void GetRestrictedPermissions(IInternalConfigRecord configRecord, out PermissionSet permissionSet, out bool isHostReady)
309+
{
310+
permissionSet = new PermissionSet(null);
311+
isHostReady = true;
312+
}
306313
}
307-
}
314+
}

src/System.Configuration.ConfigurationManager/tests/System/Configuration/TypeUtilTests.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using System.Configuration;
99
using System.Configuration.Internal;
1010
using System.IO;
11+
using System.Security;
1112
using Xunit;
1213

1314
namespace System.ConfigurationTests
@@ -299,6 +300,11 @@ bool IInternalConfigHost.IsTrustedConfigPath(string configPath)
299300
{
300301
throw new NotImplementedException();
301302
}
303+
304+
void IInternalConfigHost.GetRestrictedPermissions(IInternalConfigRecord configRecord, out PermissionSet permissionSet, out bool isHostReady)
305+
{
306+
throw new NotImplementedException();
307+
}
302308
}
303309
}
304310
}

0 commit comments

Comments
 (0)