Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.Security.Claims.PrincipalExtensions.FindFirstValue should return nullable value #32264

Closed
leotsarev opened this issue Apr 29, 2021 · 8 comments
Assignees
Labels
area-identity Includes: Identity and providers cost: XS Will take up to half a day to complete ✔️ Resolution: Duplicate Resolved as a duplicate of another issue nullable severity-minor This label is used by an internal tool Status: Resolved
Milestone

Comments

@leotsarev
Copy link

Is your feature request related to a problem? Please describe.

        //
        // Summary:
        //     Returns the value for the first claim of the specified type, otherwise null if
        //     the claim is not present.
        //
        // Parameters:
        //   principal:
        //     The System.Security.Claims.ClaimsPrincipal instance this method extends.
        //
        //   claimType:
        //     The claim type whose first value should be returned.
        //
        // Returns:
        //     The value of the first instance of the specified claim type, or null if the claim
        //     is not present.
        public static string FindFirstValue(this ClaimsPrincipal principal, string claimType);

Describe the solution you'd like

It should be public static string? FindFirstValue(this ClaimsPrincipal principal, string claimType);

@javiercn javiercn added area-identity Includes: Identity and providers nullable labels Apr 29, 2021
@blowdart blowdart added area-identity Includes: Identity and providers and removed area-identity Includes: Identity and providers labels Apr 29, 2021
@blowdart
Copy link
Contributor

Why do you believe it should be nullable? What claim are you using that has a null value? As claims are serialised as strings it's generally just string.empty

@blowdart blowdart added the Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. label Apr 29, 2021
@blowdart blowdart self-assigned this Apr 29, 2021
@leotsarev
Copy link
Author

@blowdart because it literally says so in XML doc: or null if the claim is not present. FindFirstValue source code also consistent with this.

@ghost ghost added Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. and removed Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. labels Apr 29, 2021
@blowdart
Copy link
Contributor

Ah got it. OK that makes sense @HaoK a quick one for you

@blowdart blowdart removed the Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. label Apr 29, 2021
@blowdart blowdart added this to the Next sprint planning milestone Apr 29, 2021
@ghost
Copy link

ghost commented Apr 29, 2021

Thanks for contacting us.

We're moving this issue to the Next sprint planning milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s).
If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues.
To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

@blowdart blowdart added severity-minor This label is used by an internal tool cost: XS Will take up to half a day to complete good first issue Good for newcomers. labels Apr 29, 2021
@HaoK
Copy link
Member

HaoK commented May 4, 2021

nullable isn't enabled for identity yet, so this is true in more than just this method

@leotsarev
Copy link
Author

@HaoK I didn't found tracking issue for "enable nullability for Identity"

@HaoK
Copy link
Member

HaoK commented May 6, 2021

#27389 is one of the meta work items, we have some nullable support but its not fully implemented everywhere yet

@HaoK HaoK removed the good first issue Good for newcomers. label May 26, 2021
@HaoK
Copy link
Member

HaoK commented Aug 5, 2021

Closing as this is tracked by #27389

@HaoK HaoK closed this as completed Aug 5, 2021
@HaoK HaoK added the ✔️ Resolution: Duplicate Resolved as a duplicate of another issue label Aug 5, 2021
@ghost ghost added the Status: Resolved label Aug 5, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Sep 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-identity Includes: Identity and providers cost: XS Will take up to half a day to complete ✔️ Resolution: Duplicate Resolved as a duplicate of another issue nullable severity-minor This label is used by an internal tool Status: Resolved
Projects
None yet
Development

No branches or pull requests

4 participants