Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -18,3 +18,4 @@
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.PermissionSet))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Permissions.PermissionState))]
#endif

Original file line number Diff line number Diff line change
Expand Up @@ -2091,33 +2091,4 @@ public enum AspNetHostingPermissionLevel
Unrestricted = 600,
}
}
namespace System.Xaml.Permissions
{
public partial class XamlAccessLevel
{
internal XamlAccessLevel() { }
public System.Reflection.AssemblyName AssemblyAccessToAssemblyName { get { throw null; } }
public string PrivateAccessToTypeName { get { throw null; } }
public static System.Xaml.Permissions.XamlAccessLevel AssemblyAccessTo(System.Reflection.Assembly assembly) { throw null; }
public static System.Xaml.Permissions.XamlAccessLevel AssemblyAccessTo(System.Reflection.AssemblyName assemblyName) { throw null; }
public static System.Xaml.Permissions.XamlAccessLevel PrivateAccessTo(string assemblyQualifiedTypeName) { throw null; }
public static System.Xaml.Permissions.XamlAccessLevel PrivateAccessTo(System.Type type) { throw null; }
}
public sealed partial class XamlLoadPermission : System.Security.CodeAccessPermission, System.Security.Permissions.IUnrestrictedPermission
{
public XamlLoadPermission(System.Collections.Generic.IEnumerable<System.Xaml.Permissions.XamlAccessLevel> allowedAccess) { }
public XamlLoadPermission(System.Security.Permissions.PermissionState state) { }
public XamlLoadPermission(System.Xaml.Permissions.XamlAccessLevel allowedAccess) { }
public System.Collections.Generic.IList<System.Xaml.Permissions.XamlAccessLevel> AllowedAccess { get { throw null; } }
public override System.Security.IPermission Copy() { throw null; }
public override bool Equals(object obj) { throw null; }
public override void FromXml(System.Security.SecurityElement elem) { }
public override int GetHashCode() { throw null; }
public bool Includes(System.Xaml.Permissions.XamlAccessLevel requestedAccess) { throw null; }
public override System.Security.IPermission Intersect(System.Security.IPermission target) { throw null; }
public override bool IsSubsetOf(System.Security.IPermission target) { throw null; }
public bool IsUnrestricted() { throw null; }
public override System.Security.SecurityElement ToXml() { throw null; }
public override System.Security.IPermission Union(System.Security.IPermission other) { throw null; }
}
}

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<ProjectGuid>{07CAF142-B259-418E-86EF-C4BD8B50253E}</ProjectGuid>
<IsPartialFacadeAssembly Condition="'$(TargetsNetFx)' == 'true'">true</IsPartialFacadeAssembly>
Expand All @@ -9,6 +9,9 @@
<Compile Include="System.Security.Permissions.Forwards.cs" />
<SuppressPackageTargetFrameworkCompatibility Include="$(UAPvNextTFM)" />
</ItemGroup>
<ItemGroup Condition="'$(TargetGroup)' == 'netcoreapp'">
<Compile Include="System.Security.Permissions.netcoreapp.cs" />
</ItemGroup>
<ItemGroup Condition="'$(TargetsNetFx)' == 'true'">
<Reference Include="mscorlib" />
<Reference Include="System" />
Expand Down Expand Up @@ -39,4 +42,7 @@
<ProjectReference Include="..\..\System.Text.RegularExpressions\ref\System.Text.RegularExpressions.csproj" />
<ProjectReference Include="..\..\System.Threading\ref\System.Threading.csproj" />
</ItemGroup>
<ItemGroup Condition="'$(TargetGroup)' == 'netcoreapp'">
<ProjectReference Include="..\..\System.Windows.Extensions\ref\System.Windows.Extensions.csproj" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// ------------------------------------------------------------------------------
// Changes to this file must follow the http://aka.ms/api-review process.
// ------------------------------------------------------------------------------

namespace System.Xaml.Permissions
{
public sealed partial class XamlLoadPermission : System.Security.CodeAccessPermission, System.Security.Permissions.IUnrestrictedPermission
{
public XamlLoadPermission(System.Collections.Generic.IEnumerable<System.Xaml.Permissions.XamlAccessLevel> allowedAccess) { }
public XamlLoadPermission(System.Security.Permissions.PermissionState state) { }
public XamlLoadPermission(System.Xaml.Permissions.XamlAccessLevel allowedAccess) { }
public System.Collections.Generic.IList<System.Xaml.Permissions.XamlAccessLevel> AllowedAccess { get { throw null; } }
public override System.Security.IPermission Copy() { throw null; }
public override bool Equals(object obj) { throw null; }
public override void FromXml(System.Security.SecurityElement elem) { }
public override int GetHashCode() { throw null; }
public bool Includes(System.Xaml.Permissions.XamlAccessLevel requestedAccess) { throw null; }
public override System.Security.IPermission Intersect(System.Security.IPermission target) { throw null; }
public override bool IsSubsetOf(System.Security.IPermission target) { throw null; }
public bool IsUnrestricted() { throw null; }
public override System.Security.SecurityElement ToXml() { throw null; }
public override System.Security.IPermission Union(System.Security.IPermission other) { throw null; }
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<ProjectGuid>{07390899-C8F6-4E83-A3A9-6867B8CB46A0}</ProjectGuid>
<RootNamespace>System.Security.Permissions</RootNamespace>
Expand Down Expand Up @@ -178,7 +178,8 @@
<Compile Include="System\Web\AspNetHostingPermission.cs" />
<Compile Include="System\Web\AspNetHostingPermissionAttribute.cs" />
<Compile Include="System\Web\AspNetHostingPermissionLevel.cs" />
<Compile Include="System\Xaml\Permissions\XamlAccessLevel.cs" />
</ItemGroup>
<ItemGroup Condition="'$(TargetGroup)' == 'netcoreapp'">
<Compile Include="System\Xaml\Permissions\XamlLoadPermission.cs" />
</ItemGroup>
<ItemGroup Condition="'$(TargetGroup)' == 'netstandard'">
Expand Down Expand Up @@ -228,4 +229,7 @@
<Reference Include="System.Threading" />
<Reference Include="System.Threading.Thread" />
</ItemGroup>
<ItemGroup Condition="'$(TargetGroup)' == 'netcoreapp'">
<Reference Include="System.Windows.Extensions" />
</ItemGroup>
</Project>
21 changes: 0 additions & 21 deletions src/System.Security.Permissions/tests/PermissionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using System.DirectoryServices;
using System.Reflection;
using System.Web;
using System.Xaml.Permissions;

namespace System.Security.Permissions.Tests
{
Expand Down Expand Up @@ -444,26 +443,6 @@ public static void WebBrowserPermissionAttributeCallMethods()
IPermission ip = wpa.CreatePermission();
}

[Fact]
public static void XamlLoadPermissionCallMethods()
{
XamlAccessLevel accessLevel = XamlAccessLevel.AssemblyAccessTo(Assembly.GetExecutingAssembly().GetName());
XamlLoadPermission xp = new XamlLoadPermission(accessLevel);
XamlLoadPermission xp2 = new XamlLoadPermission(PermissionState.Unrestricted);
XamlLoadPermission xp3 = new XamlLoadPermission(Array.Empty<XamlAccessLevel>());
bool testbool = xp.IsUnrestricted();
IPermission ip = xp.Copy();
IPermission ip2 = xp.Intersect(ip);
IPermission ip3 = xp.Union(ip);
testbool = xp.IsSubsetOf(ip);
testbool = xp.Equals(new object());
testbool = xp.Includes(accessLevel);
int hash = xp.GetHashCode();
SecurityElement se = new SecurityElement("");
xp.FromXml(se);
se = xp.ToXml();
}

[Fact]
public static void ZoneIdentityPermissionCallMethods()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
<Compile Include="PrincipalPermissionTests.cs" />
<Compile Include="SecurityElementTests.cs" />
<Compile Include="TrustManagerContextTests.cs" />
<Compile Include="XamlAccessLevelTests.cs" />
</ItemGroup>
<ItemGroup Condition="'$(TargetGroup)' == 'netcoreapp' And '$(TargetsWindows)' == 'true'">
<Compile Include="XamlLoadPermissionTests.cs"/>
</ItemGroup>
</Project>
38 changes: 38 additions & 0 deletions src/System.Security.Permissions/tests/XamlLoadPermissionTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using Xunit;
using System.Configuration;
using System.DirectoryServices;
using System.Reflection;
using System.Security;
using System.Security.Permissions;
using System.Web;
using System.Xaml.Permissions;

namespace System.Xaml.Permissions.Tests
{
public class XamlLoadPermissionTests
{
[Fact]
public static void XamlLoadPermissionCallMethods()
{
XamlAccessLevel accessLevel = XamlAccessLevel.AssemblyAccessTo(Assembly.GetExecutingAssembly().GetName());
XamlLoadPermission xp = new XamlLoadPermission(accessLevel);
XamlLoadPermission xp2 = new XamlLoadPermission(PermissionState.Unrestricted);
XamlLoadPermission xp3 = new XamlLoadPermission(Array.Empty<XamlAccessLevel>());
bool testbool = xp.IsUnrestricted();
IPermission ip = xp.Copy();
IPermission ip2 = xp.Intersect(ip);
IPermission ip3 = xp.Union(ip);
testbool = xp.IsSubsetOf(ip);
testbool = xp.Equals(new object());
testbool = xp.Includes(accessLevel);
int hash = xp.GetHashCode();
SecurityElement se = new SecurityElement("");
xp.FromXml(se);
se = xp.ToXml();
}
}
}
13 changes: 13 additions & 0 deletions src/System.Windows.Extensions/ref/System.Windows.Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,16 @@ public enum X509SelectionFlag
MultiSelection = 1,
}
}
namespace System.Xaml.Permissions
{
public partial class XamlAccessLevel
{
internal XamlAccessLevel() { }
public System.Reflection.AssemblyName AssemblyAccessToAssemblyName { get { throw null; } }
public string PrivateAccessToTypeName { get { throw null; } }
public static System.Xaml.Permissions.XamlAccessLevel AssemblyAccessTo(System.Reflection.Assembly assembly) { throw null; }
public static System.Xaml.Permissions.XamlAccessLevel AssemblyAccessTo(System.Reflection.AssemblyName assemblyName) { throw null; }
public static System.Xaml.Permissions.XamlAccessLevel PrivateAccessTo(string assemblyQualifiedTypeName) { throw null; }
public static System.Xaml.Permissions.XamlAccessLevel PrivateAccessTo(System.Type type) { throw null; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
<Compile Include="System\Media\SoundPlayer.cs" />
<Compile Include="System\Media\SystemSound.cs" />
<Compile Include="System\Media\SystemSounds.cs" />
<Compile Include="System\Xaml\Permissions\XamlAccessLevel.cs" />
</ItemGroup>
<ItemGroup Condition="'$(TargetGroup)' == 'netcoreapp'">
<Reference Include="System.Buffers" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<ItemGroup Condition="'$(TargetsWindows)' == 'true'">
<Compile Include="X509Certificate2UITests.cs" />
<Compile Include="X509Certificate2UIManualTests.cs" />
<Compile Include="XamlAccessLevelTests.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="$(CommonTestPath)\System\Drawing\Helpers.cs">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

Expand Down