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

Conversation

venkat-raman251
Copy link
Contributor

No description provided.

@venkat-raman251
Copy link
Contributor Author

@weshaggard : Please have a look.

private ClaimsIdentity _subject;
private string _type;
private string _value;
private string _valueType;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can any of these fields be readonly?

Choose a reason for hiding this comment

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

they are used to hold property values that are just {get}. Today's coding practice is usually { private set }.

Copy link
Member

Choose a reason for hiding this comment

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

But at the very least a field like _properties should be readonly.

Choose a reason for hiding this comment

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

A user can add a property at any time.

Copy link
Member

Choose a reason for hiding this comment

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

That doesn't affect whether the dictionary field can be readonly.

@justinvp
Copy link
Contributor

A couple other questions:

  1. Should there be a .sln file for this component?
  2. Should the commit author be changed to @dotnet-bot for the initial commit?

private ClaimsIdentity _actor;
private string _authenticationType;
private object _bootstrapContext;
private Collection<IEnumerable<Claim>> _externalClaims = new Collection<IEnumerable<Claim>>();
Copy link
Contributor

Choose a reason for hiding this comment

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

Could _externalClaims be typed as List<List<Claim>> instead of Collection<IEnumerable<Claim>>? It looks like this is only used internally and the IEnumerable<Claim>s are always List<T> already. This would be slightly more efficient than using Collection<T> and would avoid enumerator allocations when enumerating each item in the Claims property as List<T>'s struct enumerator would be used.

Choose a reason for hiding this comment

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

Yes they are only used internally and was designed for holding claims from 'roleProviders'.
I don't see any reason to avoid improving this.

@venkat-raman251
Copy link
Contributor Author

Opened a tracking issue for the proposed refactoring #4935

<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="InvalidOperation_ClaimCannotBeRemoved" xml:space="preserve">
<value>The Claim '{0}' was not able to be removed. It is either not part of this Identity or it is a claim that is owned by the Principal that contains this Identity. For example, the Principal will own the claim when creating a GenericPrincipal with roles. The roles will be exposed through the Identity that is passed in the constructor, but not actually owned by the Identity. Similar logic exists for a RolePrincipal.</value>
Copy link
Member

Choose a reason for hiding this comment

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

Nit: "claim" is sometimes capitalized and sometimes not. Not clear to me the rhyme or reason for it.

Choose a reason for hiding this comment

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

Since it is a type, how about 'Claim'? Capitalized.

Copy link
Member

Choose a reason for hiding this comment

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

I'm happy either way, as long as we're consistent 😄

@stephentoub
Copy link
Member

Are there any tests to go with the library?

<AdditionalProperties>TargetGroup=</AdditionalProperties>
</Project>
<Project Include="System.Security.Claims.csproj">
<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.

@stephentoub
Copy link
Member

@dotnet-bot Test Innerloop Ubuntu Debug Build and Test please (Jenkins failure)

return new GenericIdentity(this);
}

public override IEnumerable<Claim> Claims
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious: why is the override necessary?

@venkat-raman251
Copy link
Contributor Author

@weshaggard : Updated with all the changes. Also split into 2 commits to identify changes.

@weshaggard
Copy link
Member

LGTM

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants