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

Umbraco 8 #36

Closed Duxez closed 5 years ago

Duxez commented 5 years ago

Are there plans to support Umbraco v8?

mattbrailsford commented 5 years ago

@Duxez at some point yea, but nothing set in stone. So unless anyone else wants to attempt it, it will be as and when I need it.

marccameron3d commented 5 years ago

Hey @mattbrailsford. Upgrading it required me to up the following:

Project Target Framework .net framework 4.7.2

Nugets: UmbracoCms.core version - 8.0+
Microsoft.AspNet.WebApi.WebHost - 5.2.7.0

And also removed the Data folder with the migration scripts, after this I could use the endpoint successfully by adding Basic Configuration in the wiki to a custom IComponent.

        public class RegisterTimetableBackofficeMvcRouteComposer : IUserComposer
        {
            public void Compose(Composition composition)
            {
                composition.Components().Append<RegisterCustomBackofficeMvcRouteComponent>();
            }
        }

        public class RegisterCustomBackofficeMvcRouteComponent : IComponent
        {

            public void Initialize()
            {
                OAuth.ConfigureEndpoint("/oauth/token", new OAuthOptions
                {
                    UserService = new UmbracoMembersOAuthUserService(),
                    SymmetricKey = "856FECBA3B06519C8DDDBC80BB080553",
                    AccessTokenLifeTime = 20, // Minutes
                    AllowInsecureHttp = true // During development only
                });
            }

            public void Terminate()
            {
               throw new System.NotImplementedException();
            }
        }

This allows me to get a token form /oauth/token and dress my endpoints with the class attribute [OAuth] and method attribute [Authorize].

This is a crude way of letting it work as I wasnt sure if the Data folder contained only test migration scripts or if they have a purpose for the client store maybe?

I understand you are busy but if this is the right route, could you explain the Data folder and possible implications of removing it please?

Happy to offer a PR to help upgrade if you could point me in the direction of solving that Data folders implementation

Hope you and Lucy are well mate

marccameron3d commented 5 years ago

Couldnt help myself fall down the rabbit hole, hope this is suitable : https://github.com/mattbrailsford/umbraco-authu/pull/38

mattbrailsford commented 5 years ago

Closing this issue. Discussion can continue on PR #38