mattbrailsford / umbraco-authu

An Umbraco plugin to add an OAuth API endpoint to allow authenticated Members/Users via OAuth
MIT License
71 stars 22 forks source link

Does it work with Umbraco V9 #64

Open gordonsaxby opened 2 years ago

gordonsaxby commented 2 years ago

I have installed into an Umbraco v9.3.1 project via Nuget. I created the required classes as described at https://github.com/mattbrailsford/umbraco-authu#configuration

The solution compiles, but an error occurs when I try to run it:

System.Reflection.ReflectionTypeLoadException HResult=0x80131602 Message=Could not load all types from "Our.Umbraco.AuthU, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" due to LoaderExceptions, skipping: . System.IO.FileNotFoundException: Could not load file or assembly 'System.Web.Http, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified. . System.IO.FileNotFoundException: Could not load file or assembly 'System.Web.Http, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified. . System.IO.FileNotFoundException: Could not load file or assembly 'System.Web.Http, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified. . System.IO.FileNotFoundException: Could not load file or assembly 'System.Web.Http, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified. . System.TypeLoadException on Umbraco.Core.Migrations.MigrationPlan: Could not load type 'Umbraco.Core.Migrations.MigrationPlan' from assembly 'Umbraco.Core, Version=9.3.1.0, Culture=neutral, PublicKeyToken=null'. . System.TypeLoadException on Umbraco.Core.Migrations.MigrationBase: Could not load type 'Umbraco.Core.Migrations.MigrationBase' from assembly 'Umbraco.Core, Version=9.3.1.0, Culture=neutral, PublicKeyToken=null'. . System.TypeLoadException on Umbraco.Core.Migrations.MigrationBase: Could not load type 'Umbraco.Core.Migrations.MigrationBase' from assembly 'Umbraco.Core, Version=9.3.1.0, Culture=neutral, PublicKeyToken=null'. . System.TypeLoadException on Umbraco.Core.Migrations.MigrationBase: Could not load type 'Umbraco.Core.Migrations.MigrationBase' from assembly 'Umbraco.Core, Version=9.3.1.0, Culture=neutral, PublicKeyToken=null'. . System.TypeLoadException on Umbraco.Core.Migrations.MigrationBase: Could not load type 'Umbraco.Core.Migrations.MigrationBase' from assembly 'Umbraco.Core, Version=9.3.1.0, Culture=neutral, PublicKeyToken=null'. . System.TypeLoadException on Umbraco.Core.Composing.IUserComposer: Could not load type 'Umbraco.Core.Composing.IUserComposer' from assembly 'Umbraco.Core, Version=9.3.1.0, Culture=neutral, PublicKeyToken=null'. . System.TypeLoadException on Umbraco.Core.Composing.IComponent: Could not load type 'Umbraco.Core.Composing.IComponent' from assembly 'Umbraco.Core, Version=9.3.1.0, Culture=neutral, PublicKeyToken=null'.

Could not load file or assembly 'System.Web.Http, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified. Could not load file or assembly 'System.Web.Http, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified. Could not load file or assembly 'System.Web.Http, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified. Could not load file or assembly 'System.Web.Http, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified. Could not load type 'Umbraco.Core.Migrations.MigrationPlan' from assembly 'Umbraco.Core, Version=9.3.1.0, Culture=neutral, PublicKeyToken=null'. Could not load type 'Umbraco.Core.Migrations.MigrationBase' from assembly 'Umbraco.Core, Version=9.3.1.0, Culture=neutral, PublicKeyToken=null'. Could not load type 'Umbraco.Core.Migrations.MigrationBase' from assembly 'Umbraco.Core, Version=9.3.1.0, Culture=neutral, PublicKeyToken=null'. Could not load type 'Umbraco.Core.Migrations.MigrationBase' from assembly 'Umbraco.Core, Version=9.3.1.0, Culture=neutral, PublicKeyToken=null'. Could not load type 'Umbraco.Core.Migrations.MigrationBase' from assembly 'Umbraco.Core, Version=9.3.1.0, Culture=neutral, PublicKeyToken=null'. Could not load type 'Umbraco.Core.Composing.IUserComposer' from assembly 'Umbraco.Core, Version=9.3.1.0, Culture=neutral, PublicKeyToken=null'. Could not load type 'Umbraco.Core.Composing.IComponent' from assembly 'Umbraco.Core, Version=9.3.1.0, Culture=neutral, PublicKeyToken=null'. Source=Umbraco.Core StackTrace: at Umbraco.Cms.Core.Composing.TypeFinder.GetTypesWithFormattedException(Assembly a) at Umbraco.Cms.Core.Composing.TypeFinder.GetClassesWithBaseType(Type baseType, IEnumerable1 assemblies, Boolean onlyConcreteClasses, Func2 additionalFilter) at Umbraco.Cms.Core.Composing.TypeFinder.FindClassesOfType(Type assignTypeFrom, IEnumerable1 assemblies, Boolean onlyConcreteClasses) at Umbraco.Extensions.TypeFinderExtensions.FindClassesOfType[T](ITypeFinder typeFinder, IEnumerable1 assemblies, Boolean onlyConcreteClasses) at Umbraco.Cms.Core.Composing.TypeLoader.<>cDisplayClass56_01.<GetTypes>b__0() at Umbraco.Cms.Core.Composing.TypeLoader.GetTypesInternalLocked(Type baseType, Type attributeType, Func1 finder, String action, Boolean cache) at Umbraco.Cms.Core.Composing.TypeLoader.GetTypesInternal(Type baseType, Type attributeType, Func1 finder, String action, Boolean cache) at Umbraco.Cms.Core.Composing.TypeLoader.GetTypes[T](Boolean cache, IEnumerable1 specificAssemblies) at Umbraco.Cms.Core.DependencyInjection.UmbracoBuilderExtensions.AddAllCoreCollectionBuilders(IUmbracoBuilder builder) at Umbraco.Cms.Core.DependencyInjection.UmbracoBuilder.AddCoreServices() at Umbraco.Cms.Core.DependencyInjection.UmbracoBuilder..ctor(IServiceCollection services, IConfiguration config, TypeLoader typeLoader, ILoggerFactory loggerFactory, IProfiler profiler, AppCaches appCaches, IHostingEnvironment hostingEnvironment) at Umbraco.Extensions.UmbracoBuilderExtensions.AddUmbraco(IServiceCollection services, IWebHostEnvironment webHostEnvironment, IConfiguration config) at MyWebsite.Startup.ConfigureServices(IServiceCollection services) in C:\Development\Fifth Dimension\MyWebsite\trunk\MyWebsite\MyWebsite\Startup.cs:line 46 at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.InvokeCore(Object instance, IServiceCollection services) at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass9_0.gStartup|0(IServiceCollection serviceCollection) at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.Invoke(Object instance, IServiceCollection services) at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>cDisplayClass8_0.b0(IServiceCollection services) at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.UseStartup(Type startupType, HostBuilderContext context, IServiceCollection services, Object instance) at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>cDisplayClass13_0.b0(HostBuilderContext context, IServiceCollection services) at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider() at Microsoft.Extensions.Hosting.HostBuilder.Build() at MyWebsite.Program.Main(String[] args) in C:\Development\Fifth Dimension\MyWebsite\trunk\MyWebsite\MyWebsite\Program.cs:line 12

mattbrailsford commented 2 years ago

AuthU is currently Umbraco v8 and lower only. I haven’t reviewed the current landscape for implementing OAuth in .NET Core so don’t have any idea of whether this pkg is even worth porting. To be honest though, it’s not high on my priority list right now so don’t have an idea of when I’m likely to look into it.

I’m open to a PR / discussion if someone wants to see what is possible.

gordonsaxby commented 2 years ago

Thanks for letting me know Matt. Unfortunately, I've not used Umbraco v8 and I am very new to v9 and .Net Core, so I'm not sure I'm the best person to investigate. However, I think I have some time over the next couple of days so I will try and have a look (never know, it might be an easy fix!)

mattbrailsford commented 2 years ago

Even just looking into .NET Core to see how easy OAuth is on it's own now (I really only created AuthU because OAuth was an absolute nightmare to setup before) as this would highlight whether this package is even necessary or not. 👍

gordonsaxby commented 2 years ago

Unfortunately, converting this to Umbraco V9 (.Net Core 6) does not appear to be very easy, or within my skillset :-(

somoreingold commented 2 years ago

I'm definitely interested in this as well; I'm hoping to reconcile this with this tutorial at some point this year: https://jasonwatmore.com/post/2022/01/24/net-6-jwt-authentication-with-refresh-tokens-tutorial-with-example-api