BeautifulRestApi icon indicating copy to clipboard operation
BeautifulRestApi copied to clipboard

Update to ASP.NET Core 2.0

Open KeithT opened this issue 8 years ago • 6 comments

Just completed (nearly all) your Lynda course (which is excellent by the way) following along using Core 2. I thought you might be interested in a couple of things that break:

In Startup.cs:

        // Add ASP.NET Core Identity
            services.AddIdentity<UserEntity, UserRoleEntity>()
                .AddEntityFrameworkStores<HotelApiContext, Guid>()
                .AddDefaultTokenProviders();

needs to go to:

        // Add ASP.NET Core Identity
            services.AddIdentity<UserEntity, UserRoleEntity>()
                .AddEntityFrameworkStores<HotelApiContext>()
                .AddDefaultTokenProviders();

and in the UsersController.cs:

                var canSeeEveryone = await _authzService
                    .AuthorizeAsync(User, "ViewAllUsersPolicy");
                if (canSeeEveryone)
                {
                    users = await _userService.GetUsersAsync(
                        pagingOptions, sortOptions, searchOptions, ct);
                }

Error CS0029 Cannot implicitly convert type 'Microsoft.AspNetCore.Authorization.AuthorizationResult' to 'bool' bodimecore ...\Controllers\UsersController.cs error

Which I've not had time to look at yet. (Monday hopefully). Thanks again for the great course.

KeithT avatar Aug 25 '17 15:08 KeithT

Thanks for watching the course! I'm glad it was helpful.

I need to update this repo (and the course eventually) to all the Core 2.0 packages. I just haven't had time yet. Thanks for the reminder. 👍

nbarbettini avatar Aug 25 '17 16:08 nbarbettini

I've not been able to get the authentication part working, there seems to be significant changes in Core 2 in this area: https://github.com/aspnet/Announcements/issues/232.

Blocked by: Could not load type 'Microsoft.AspNetCore.Builder.AuthenticationOptions' from assembly 'Microsoft.AspNetCore.Authentication in Startup at

app.UseOAuthValidation(); app.UseOpenIddict();

I've tried different package versions of things e.g. tried upgrading OpenIddict, downgrading System.IdentityModel.Tokens.Jwt with no luck

Any pointers greatly appreciated.

KeithT avatar Aug 28 '17 06:08 KeithT

Although a new course that I just watched, Its great btw. The authentication section, that was my only issue to start with, is already obsolete. Can you PLEASE, update it to Core 2, and maybe show the hash method as well as identity.

EthernetIp avatar Oct 20 '17 15:10 EthernetIp

Updates are a little delayed but definitely coming.

What's the hash method you mentioned?

nbarbettini avatar Oct 20 '17 15:10 nbarbettini

Digest authentication , MD5 hashing I guess.

Tx in advance.

EthernetIp avatar Oct 20 '17 20:10 EthernetIp

Hi,

this looks really good. Have you started to update this to core/net standard 2.0? If not I'm happy to do this and submit a pr, if that would help?

SeanFarrow avatar Sep 05 '18 12:09 SeanFarrow