+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Always getting anonymous identity using OpenAccessMembership37Provider in Sitefinity 8 (default provider in parrallel)

Always getting anonymous identity using OpenAccessMembership37Provider in Sitefinity 8 (default provider in parrallel)

2 posts, 0 answered
  1. Wolfgang
    Wolfgang avatar
    1 posts
    Registered:
    22 Dec 2015
    05 Feb
    Link to this post

    I hav to use both the lagacy and default membership provider on the site. So I enabled the OpenAccessMembership37Provider in sitefinity's backend.

    After I've managed to imort the users from an old sitefinity site into the the new, I encountered a rather strange issue:

    I am actually able to log in using an imported user's credentials. I use a trial-and-error approach to find out about the provider to use:

    User user = null;
    UserLoggingReason result;
    var providerName = UserManager.GetDefaultProviderName();
     
    var userId = SecurityManager.GetUserId(providerName, input.UserName);
    if (userId.Equals(Guid.Empty))
    {
        providerName = "OpenAccessMembership37Provider";
        userId = SecurityManager.GetUserId(providerName, input.UserName);
    }
    if (userId.Equals(Guid.Empty)) result = UserLoggingReason.Unknown;
    else
    {
        result = SecurityManager.AuthenticateUser(
            providerName,
            input.UserName,
            input.Password,
            input.RememberMe,
            out user);
    }

    The setup in my web.config is:

    <membership defaultProvider="Default">
      <providers>
        <clear />
        <add name="Default" type="Telerik.Sitefinity.Security.Data.SitefinityMembershipProvider, Telerik.Sitefinity" />
        <add name="OpenAccessMembership37Provider" type="Telerik.Sitefinity.Modules.Migration.Security.Data.OpenAccessMembership37Provider, Telerik.Sitefinity.Migration"/>
      </providers>
    </membership>
    Not sure if this is a good setup.
    Now, authenticated as a user in the legacy provider, I get the correct Identity via ClaimsManager.GetCurrentIdentity() in any control as long as it is situated on a page that hasn't been visited before, since a restart of the site. When I visit a page having been already rendered before the login, ClaimsManager.GetCurrentIdentity() returns anonymous.

    So I've been looking arround for a possibility to try out both providers when retrieving the current identity (similar to the login procedure), but havent found so far. My best guess was this might be a type of a caching issue, but if so, why does this work with the default provider? Is there something wrong with my setup?

  2. Velizar Bishurov
    Velizar Bishurov avatar
    143 posts
    Registered:
    01 Dec 2016
    10 Feb
    Link to this post
    Hello,

    I have noticed that you have already opened a support ticket for this issue. I suggest we continue the communication there and once we have the solution figured out feel free to post it here for the community.

    Regards,
    Velizar Bishurov
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
2 posts, 0 answered