4

I'm experiencing an issue with the Preview functionality when logged in to Sitecore through Azure Active Directory.

Logging in through AD is following this approach: http://blog.baslijten.com/how-to-add-federated-authentication-with-sitecore-and-owin/

Once the Claim is returned from OWIN, a virtual user is created with the Role information from the claim and then logged into Sitecore.

Logging into Sitecore works just fine and I'm able to open up and use Experience Editor as normal. Whenever I try to launch Preview (either from the Publish tab or ribbon bar in Experience Editor), the below exception is thrown.

After the below error has occurred, the user must also re-log in to Sitecore again. If they try to close the preview tab and continue in Sitecore, the same error occurs.

One thing I have noticed when debugging through this is that when viewing Preview the Sitecore.Pipelines.HttpRequest.HttpRequestArgs.Context.User.Identity.Name changes from sitecore/userEmail to default/anonymous. Not sure if the change in user identity for Preview would be causing an automatic log out of the user when logged in through AD.

Has anybody run into something similar or know where to start looking?

7976 13:35:20 ERROR Application error. Exception: System.InvalidOperationException Message: membership user Source: Sitecore.Kernel at Sitecore.Web.Authentication.DefaultTicketManager.HasAccessForLogin(Ticket ticket) at Sitecore.Web.Authentication.DefaultTicketManager.Relogin(String ticketId, Boolean redirect) at Sitecore.Shell.Web.ShellPage.IsLoggedIn(Boolean returnAfterLogin)
at Sitecore.Mvc.Pipelines.Request.RequestBegin.EnsureLoggedInForPreview.Process(PipelineArgs args) at (Object , Object[] ) at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) at Sitecore.Mvc.Pipelines.PipelineService.RunPipeline[TArgs](String pipelineName, TArgs args) at Sitecore.Mvc.Routing.RouteHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

3

I found that there is a configuration setting that can be enabled which runs the preview mode with the currently logged in user (an authenticated user) instead of the default/anonymous user.

It's called Preview.AsAnonymous, and setting this setting to false will allow users to preview as the currently authenticated user instead.

Source: USING AN AUTHENTICATED PREVIEW IN SITECORE

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.