Copied to clipboard

Flag this post as spam?

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


  • Brad Wickett 43 posts 124 karma points
    Sep 16, 2016 @ 15:16
    Brad Wickett
    0

    Preview with Custom Backoffice Authentication

    We are using a custom Backoffice OWIN provider to authenticate our users against our local Active Directory. However, since switching to this new method a few versions ago the Preview feature no longer works. I can see in the .config file in the \Umbraco\App_Data\Preview folder that the changes exist in the XML. However, the preview window still shows the old content. I believe this has to do with some sort of permissions issue for the user since we are doing our own authentication. Is there something else I need to set during the authentication to get the preview function working again?

  • Brad Wickett 43 posts 124 karma points
    Sep 19, 2016 @ 17:22
    Brad Wickett
    0

    I have confirmed that this is in fact due to our custom owin:appStartup code. When I setup a test install of Umbraco to point to our same backend database, but use the default UmbracoDefaultOwinStartup value, I can preview just fine. This must have to do with the way the preview detects the currently-logged-in user to show them the preview. I must be missing something in my custom owin code that needs to be set for the session to indicate who the current user is. Any ideas what needs to be set for this? Are you using something in User.Identity, or some session variable?

  • Brad Wickett 43 posts 124 karma points
    Sep 19, 2016 @ 19:49
    Brad Wickett
    0

    After a day of troubleshooting I think I've answered my own question. In the public void Configuration(IAppBuilder app) function where I specify my IBackOfficeUserPasswordChecker password checker function, I needed to first set the following app options:

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

    All the examples I had seen omitted the last option, which prevented the preview from working.

Please Sign in or register to post replies

Write your reply to:

Draft