Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tony Cheetham 24 posts 134 karma points
    Nov 04, 2015 @ 10:38
    Tony Cheetham
    0

    Replacing Umbraco backend login with openidconnect

    I'm trying to replace the backend login to Umbraco with an openidconnect server I am running. I have all of the code to handle auth successfully working within the Umbraco project, but I am struggling to make it replace the backend authentication. I have installed UmbracoIdentityExtensions, replaced the standard owin startup in the web.config with the umbracostandardowinstartup and changed the code in it to look like this;

        public class UmbracoStandardOwinStartup : UmbracoDefaultOwinStartup
    {
        public override void Configuration(IAppBuilder app)
        {
            //ensure the default options are configured
            base.Configuration(app);
    
            app.UseUmbracoBackOfficeCookieAuthentication(ApplicationContext.Current);
            app.UseUmbracoBackOfficeExternalCookieAuthentication(ApplicationContext.Current);
    
            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie
            });
    
            app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions
            {
                Authority = "https://localhost:44333/identity",
                ClientId = "MVCTestsite",
                RedirectUri = "http://localhost:44302/Umbraco",
                ResponseType = "id_token",
                Scope = "openid profile roles email",
    
                SignInAsAuthenticationType = CookieAuthenticationDefaults.AuthenticationType
            });
        }
    }
    

    Unfortunately it is here that I am stuck. I do not know how to change the back-end login from using the Umbraco authentication to using my custom provider.

    Any help or pointers would be greatly appreciated!

  • Greg Manrodt 4 posts 96 karma points
    Nov 04, 2015 @ 18:52
    Greg Manrodt
    100

    My experience with getting this exact scenario working has been mixed. I don't love the Umbraco implementation of linking External account to internal accounts, but perhaps it will be ok in your scenario...

    Having looked at your code above, I believe that you are missing a few things. First, I found that I didn't need these two lines at all:

    app.UseUmbracoBackOfficeCookieAuthentication(ApplicationContext.Current);   
    app.UseUmbracoBackOfficeExternalCookieAuthentication(ApplicationContext.Current);
    

    Second, you seem to be missing these:

    idServerOptions.Caption = caption;
    idServerOptions.ForUmbracoBackOffice(style, icon);
    

    Last, I believe that you need to set the SignInAsAuthenticationType to be Constants.Security.BackOfficeExternalAuthenticationType

    Hope this helps!

  • Tony Cheetham 24 posts 134 karma points
    Nov 06, 2015 @ 11:46
    Tony Cheetham
    0

    This might explain a lot about my issue.. under my IDServer options there is no "ForUmbracoBackOffice". Going to dig into this, but if you have an idea I'd appreciate the assist.

  • Tony Cheetham 24 posts 134 karma points
    Nov 06, 2015 @ 12:07
    Tony Cheetham
    0

    Would you believe it.. The issue was the missing icon and caption. I now have other issues, but the auth is working! Thanks for the help Gregg!

Please Sign in or register to post replies

Write your reply to:

Draft