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

Use of Deprecated Package #134

Closed
MrChriZ opened this issue Dec 8, 2023 · 16 comments
Closed

Use of Deprecated Package #134

MrChriZ opened this issue Dec 8, 2023 · 16 comments
Assignees
Labels
Bug Something isn't working

Comments

@MrChriZ
Copy link

MrChriZ commented Dec 8, 2023

Describe the issue
In your new BlazorWebAssemblyStandaloneWithIdentity project, in the backend you appear to be using the now deprecated package
Microsoft.AspNetCore.Identity 2.2.0?

Am I missing something?

To Reproduce
Steps to reproduce the behavior:
Open project and look at dependancies.

Expected behavior
No deprecated dependancies

Screenshots
2023-12-08_16-06

Additional context
Add any other context about the issue here.

.NET Version
8.0


Issue Details

Do not edit this section. It is required for issue processing.

@MrChriZ MrChriZ added the Not triaged Awaiting review label Dec 8, 2023
@guardrex
Copy link
Collaborator

guardrex commented Dec 8, 2023

No, that's the latest version of that package. That one doesn't version with a number that matches the shared framework.

https://www.nuget.org/packages/Microsoft.AspNetCore.Identity

@guardrex guardrex closed this as completed Dec 8, 2023
@MrChriZ
Copy link
Author

MrChriZ commented Dec 8, 2023

Sorry I don't understand - the latest version is deprecated as per the link you've provided?

@guardrex
Copy link
Collaborator

guardrex commented Dec 8, 2023

It's a false warning ... one doesn't typically use the package directly like this. Normally, this is used by the metapackage. I think a remark about this in the article makes sense. I'll open an issue and address it next week. I'll ping u on the issue in a moment.

@guardrex
Copy link
Collaborator

guardrex commented Dec 8, 2023

... and I'll check further on this. I actually thought that if the shared framework has the package reference that it wouldn't need to be in the app's project file. I'll investigate and get back to you shortly.

@MrChriZ
Copy link
Author

MrChriZ commented Dec 8, 2023

Thanks - It would be good to have some clarity. I've used it in a .NET 7 project already directly and I've seen posts across the web where people are unsure about what they should be using in place of Microsoft.AspNetCore.Identity - or if it is good to continue using it.

@guardrex
Copy link
Collaborator

guardrex commented Dec 8, 2023

Yep! I was right. That package reference shouldn't be there. It's provided by the shared framework. I'll re-open and remove it now.

Yes, you should be using it ... but NOT directly like this. I think Jeremy just made a slight mistake including it. It comes in via the shared framework. The app doesn't need a package reference for it.

@guardrex guardrex reopened this Dec 8, 2023
@guardrex guardrex added Bug Something isn't working and removed Not triaged Awaiting review labels Dec 8, 2023
@guardrex
Copy link
Collaborator

guardrex commented Dec 8, 2023

Ok ... we're good now ... fixed on commit ...

9f7ea51

Thanks for opening this issue!

@guardrex guardrex closed this as completed Dec 8, 2023
@MrChriZ
Copy link
Author

MrChriZ commented Dec 8, 2023

Thanks - I think if you just remove the package you'll have the following error:
Error CS0246 The type or namespace name 'ClaimsPrincipal' could not be found (are you missing a using directive or an assembly reference?) Program.cs

potentially this can be resolved by referencing System.Security.Claims

@guardrex
Copy link
Collaborator

guardrex commented Dec 8, 2023

I didn't that error here. Where is that being thrown? ... which project? ... and is that for custom code. We won't cover anything beyond the base use case; however, this sample will be expanded later to include a role claims endpoint in the backend so that the frontend can implement user roles.

@MrChriZ
Copy link
Author

MrChriZ commented Dec 8, 2023

That's simply downloading your repository. No code changed. (I pulled the project into a VS solution but that's it).
After referencing the System.Security.Claims in Program.cs the project compiles fine

@MrChriZ
Copy link
Author

MrChriZ commented Dec 8, 2023

And sorry it's in the 8.0 Backend project as per my original screenshot.

@guardrex guardrex mentioned this issue Dec 8, 2023
@guardrex
Copy link
Collaborator

guardrex commented Dec 8, 2023

Ah! I see it had the MVC package there for it. I changed it to your suggestion of System.Security.Claims on ...

#135

https://github.com/dotnet/blazor-samples/blob/main/8.0/BlazorWebAssemblyStandaloneWithIdentity/Backend/Program.cs#L1

@MrChriZ
Copy link
Author

MrChriZ commented Dec 8, 2023

Fab thanks! :)

@guardrex
Copy link
Collaborator

guardrex commented Dec 8, 2023

That's what I had locally. Not sure why a delta existed between the repo and local app. VS these days makes namespace changes to files all by itself. I'll blame VS here for making my app correct! 😆

Thanks again for the issue. As you can see, we're still working a lot of 🪲 out of the docs and samples for 8.0. That process will continue for months.

@MrChriZ
Copy link
Author

MrChriZ commented Dec 8, 2023

This is all good news as far as I'm concerned. Back in April I was working on a project to implement something like what you now have built in and much hair was lost figuring it out! 😆
What I've seen so far looks great! :)

@guardrex
Copy link
Collaborator

guardrex commented Dec 8, 2023

I agree. We needed this for years ... and was asked for it quite a bit. We do need the roles piece for sure. However ... even in this form ... it shoudn't be too difficult for folks to roll their own controller into the backend and send back role claims for use by the frontend.

We're going to leave the extra coverage on the other scenarios/endpoints (e.g., 2FA) over in the main doc set. That coverage is being worked on now at ...

dotnet/AspNetCore.Docs#31197

What I don't know is if they'll relent and provide a fully working implementation for token auth. Right now, they just guide toward it with notes and a partial implementation. I'm telling them on ...

dotnet/AspNetCore.Docs#31214

... that I think it should be fully worked out and presented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants