Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Porting System.Security.Claims #4933

Merged
merged 2 commits into from
Dec 29, 2015
Merged
Show file tree
Hide file tree
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
Prev Previous commit
Changes to system.security.claims
  • Loading branch information
dotnet-bot authored and venkat-raman251 committed Dec 28, 2015
commit 353640643c1cc528f9688a289d0e80c0b317b3ae
5 changes: 1 addition & 4 deletions src/System.Security.Claims/src/System.Security.Claims.builds
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<Project Include="facade\System.Security.Claims.csproj" Condition="'$(TargetsWindows)' == 'true'">
<AdditionalProperties>TargetGroup=net46</AdditionalProperties>
</Project>
<Project Include="System.Security.Claims.csproj">
<AdditionalProperties>TargetGroup=</AdditionalProperties>
</Project>
<Project Include="System.Security.Claims.csproj">
<Project Include="System.Security.Claims.csproj" Condition="'$(TargetsWindows)' == 'true'">
<AdditionalProperties>TargetGroup=net46</AdditionalProperties>
Copy link
Member

Choose a reason for hiding this comment

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

This is a duplication of facade\System.Secrit.Claims.csproj configuration. As part of your change you should eliminate the facade folder completely given you have folded it into this project. Also condition this on TargetsWindows=true

Copy link
Member

Choose a reason for hiding this comment

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

@venkat-raman251 please collapse these net46 configurations.

</Project>
</ItemGroup>
Expand Down
48 changes: 17 additions & 31 deletions src/System.Security.Claims/src/System.Security.Claims.csproj
Original file line number Diff line number Diff line change
@@ -1,47 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<Import Project="..\dir.settings.targets" />
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<DefineConstants>$(DefineConstants);PROJECTK</DefineConstants>
<IsProjectNLibrary>true</IsProjectNLibrary>
<IsNETCoreForCoreCLRLibrary>true</IsNETCoreForCoreCLRLibrary>
<IsProjectKLibrary>true</IsProjectKLibrary>
<IsTestNetLibrary>true</IsTestNetLibrary>
<AssemblyName>System.Security.Claims</AssemblyName>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
<ProjectGuid>{A70BEC0D-5A1C-4DA0-8A0F-69F3BF565D52}</ProjectGuid>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<PackageTargetFramework>dotnet5.4</PackageTargetFramework>
<PackageTargetFramework Condition="'$(PackageTargetFramework)'==''">dotnet5.4</PackageTargetFramework>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)'=='net46'">true</IsPartialFacadeAssembly>
</PropertyGroup>
<!-- Default configurations to help VS understand the options -->
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|amd64' ">
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|amd64' ">
</PropertyGroup>
<ItemGroup>
<Reference Include="System.Collections" />
<Reference Include="System.Globalization" />
<Reference Include="System.IO" />
<Reference Include="System.Resources.ResourceManager" />
<Reference Include="System.Runtime">
<Version>4.0.20.0</Version>
</Reference>
<Reference Include="System.Runtime.Extensions" />
<Reference Include="System.Security.Principal" />
</ItemGroup>
<ItemGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'net46_Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'net46_Release|AnyCPU'" />

<ItemGroup Condition="'$(TargetGroup)'==''" >
<Compile Include="System\Security\Claims\Claim.cs" />
<Compile Include="System\Security\Claims\ClaimsIdentity.cs" />
<Compile Include="System\Security\Claims\ClaimsPrincipal.cs" />
<Compile Include="System\Security\Claims\ClaimTypes.cs" />
<Compile Include="System\Security\Claims\ClaimValueTypes.cs" />
<Compile Include="System\Security\Claims\GenericIdentity.cs" />
<Compile Include="System\Security\Claims\GenericPrincipal.cs" />
<Compile Include="System\Security\Claims\GenericPrincipal.cs" />
</ItemGroup>
<ItemGroup Condition="'$(TargetGroup)'=='net46'">
<TargetingPackReference Include="mscorlib" />
</ItemGroup>
<ItemGroup>
<None Include="project.json" />
</ItemGroup>
<Import Project="..\dir.targets" />
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//------------------------------------------------------------------------------


//

//
// Claim.cs
//

using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.IO;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,13 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//------------------------------------------------------------------------------


//

//
// ClaimTypes.cs
//

using System.Runtime.InteropServices;

namespace System.Security.Claims
{
/// <summary>
/// Defines the claim types that are supported by the framework.
/// </summary>
[ComVisible(false)]
/// </summary>
public static class ClaimTypes
{
internal const string ClaimTypeNamespace = "http://schemas.microsoft.com/ws/2008/06/identity/claims";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,13 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//------------------------------------------------------------------------------


//

//
// ClaimValueTypes.cs
//

using System.Runtime.InteropServices;

namespace System.Security.Claims
{
/// <summary>
/// Defines the claim value types of the framework.
/// </summary>
[ComVisible(false)]
public static class ClaimValueTypes
{
const string XmlSchemaNamespace = "http://www.w3.org/2001/XMLSchema";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.


//

//
// ClaimsIdentity.cs
//

using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics.Contracts;
Expand All @@ -21,7 +14,6 @@ namespace System.Security.Claims
/// <summary>
/// An Identity that is represented by a set of claims.
/// </summary>
[ComVisible(true)]
public class ClaimsIdentity : IIdentity
{
private enum SerializationMask
Expand Down Expand Up @@ -288,7 +280,6 @@ public object BootstrapContext
{
get { return _bootstrapContext; }

[SecurityCritical]
set
{ _bootstrapContext = value; }
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: formatting here looks strange

}
Expand Down Expand Up @@ -400,7 +391,6 @@ public virtual ClaimsIdentity Clone()
/// <param name="claim">the <see cref="Claim"/>add.</param>
/// <remarks>If <see cref="Claim.Subject"/> != this, then Claim.Clone(this) is called before the claim is added.</remarks>
/// <exception cref="ArgumentNullException">if 'claim' is null.</exception>
[SecurityCritical]
public virtual void AddClaim(Claim claim)
{
if (claim == null)
Expand All @@ -426,7 +416,6 @@ public virtual void AddClaim(Claim claim)
/// <param name="claims">Enumeration of claims to add.</param>
/// <remarks>Each claim is examined and if <see cref="Claim.Subject"/> != this, then then Claim.Clone(this) is called before the claim is added.</remarks>
/// <exception cref="ArgumentNullException">if 'claims' is null.</exception>
[SecurityCritical]
public virtual void AddClaims(IEnumerable<Claim> claims)
{
if (claims == null)
Expand Down Expand Up @@ -461,7 +450,6 @@ public virtual void AddClaims(IEnumerable<Claim> claims)
/// <remarks> It is possible that a <see cref="Claim"/> returned from <see cref="Claims"/> cannot be removed. This would be the case for 'External' claims that are provided by reference.
/// <para>object.ReferenceEquals is used to 'match'.</para>
/// </remarks>
[SecurityCritical]
public virtual bool TryRemoveClaim(Claim claim)
{
if (claim == null)
Expand Down Expand Up @@ -491,7 +479,6 @@ public virtual bool TryRemoveClaim(Claim claim)
/// <para>object.ReferenceEquals is used to 'match'.</para>
/// </remarks>
/// <exception cref="InvalidOperationException">if 'claim' cannot be removed.</exception>
[SecurityCritical]
public virtual void RemoveClaim(Claim claim)
{
if (!TryRemoveClaim(claim))
Expand All @@ -508,7 +495,6 @@ public virtual void RemoveClaim(Claim claim)
/// </summary>
/// <param name="claims">a <see cref="IEnumerable<Claim>"/> to add to </param>
/// <remarks>private only call from constructor, adds to internal list.</remarks>
[SecuritySafeCritical]
private void SafeAddClaims(IEnumerable<Claim> claims)
{
foreach (Claim claim in claims)
Expand All @@ -531,7 +517,6 @@ private void SafeAddClaims(IEnumerable<Claim> claims)
/// Adds claim to intenal list. Calling Claim.Clone if Claim.Subject != this.
/// </summary>
/// <remarks>private only call from constructor, adds to internal list.</remarks>
[SecuritySafeCritical]
private void SafeAddClaim(Claim claim)
{
if (claim == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//------------------------------------------------------------------------------


//

//
// ClaimPrincipal.cs
//

using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.IO;
Expand All @@ -20,7 +13,6 @@ namespace System.Security.Claims
/// <summary>
/// Concrete IPrincipal supporting multiple claims-based identities
/// </summary>
[ComVisible(true)]
public class ClaimsPrincipal : IPrincipal
{
private enum SerializationMask
Expand Down Expand Up @@ -63,7 +55,6 @@ public static Func<IEnumerable<ClaimsIdentity>, ClaimsIdentity> PrimaryIdentityS
{
return s_identitySelector;
}
[SecurityCritical]
set
{
s_identitySelector = value;
Expand All @@ -76,7 +67,6 @@ public static Func<ClaimsPrincipal> ClaimsPrincipalSelector
{
return s_principalSelector;
}
[SecurityCritical]
set
{
s_principalSelector = value;
Expand Down Expand Up @@ -183,7 +173,6 @@ public ClaimsPrincipal(BinaryReader reader)
/// </summary>
/// <param name="identity">the <see cref="ClaimsIdentity"/>add.</param>
/// <exception cref="ArgumentNullException">if 'identity' is null.</exception>
[SecurityCritical]
public virtual void AddIdentity(ClaimsIdentity identity)
{
if (identity == null)
Expand All @@ -201,7 +190,6 @@ public virtual void AddIdentity(ClaimsIdentity identity)
/// </summary>
/// <param name="identities">Enumeration of ClaimsIdentities to add.</param>
/// <exception cref="ArgumentNullException">if 'identities' is null.</exception>
[SecurityCritical]
public virtual void AddIdentities(IEnumerable<ClaimsIdentity> identities)
{
if (identities == null)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.


//

//
// GenericIdentity.cs
//
// A generic identity
//

using System;
using System.Diagnostics.Contracts;
using System.Security.Claims;
Expand All @@ -24,7 +15,6 @@ public class GenericIdentity : ClaimsIdentity
private string m_name;
private string m_type;

[SecuritySafeCritical]
public GenericIdentity(string name)
{
if (name == null)
Expand All @@ -37,7 +27,6 @@ public GenericIdentity(string name)
AddNameClaim();
}

[SecuritySafeCritical]
public GenericIdentity(string name, string type)
{
if (name == null)
Expand Down Expand Up @@ -106,7 +95,6 @@ public override bool IsAuthenticated
}


[SecuritySafeCritical]
private void AddNameClaim()
{
if (m_name != null)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.


//

//
// GenericPrincipal.cs
//

using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
Expand Down Expand Up @@ -48,7 +41,6 @@ public GenericPrincipal(IIdentity identity, string[] roles)
/// <summary>
/// helper method to add roles
/// </summary>
[SecuritySafeCritical]
void AddIdentityWithRoles(IIdentity identity, string[] roles)
{
ClaimsIdentity claimsIdentity = identity as ClaimsIdentity;
Expand Down

This file was deleted.

9 changes: 0 additions & 9 deletions src/System.Security.Claims/src/facade/project.json

This file was deleted.

21 changes: 21 additions & 0 deletions src/System.Security.Claims/src/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"frameworks": {
"dotnet5.4": {
"dependencies": {
"System.Collections": "4.0.0",
"System.Diagnostics.Contracts": "4.0.0",
"System.Globalization": "4.0.0",
"System.IO": "4.0.0",
"System.Resources.ResourceManager": "4.0.0",
"System.Runtime": "4.0.20",
"System.Runtime.Extensions": "4.0.0",
"System.Security.Principal": "4.0.0"
}
},
"net46":{
"dependencies": {
"Microsoft.TargetingPack.NetFramework.v4.6": "1.0.0",
}
}
}
}