I am investigating using Sitecore virtual users so that I can authenticate with an external system and log users in that way. However, I also need to be able to support the persistent flag. Currently my code looks something like this:
var virtualUser = AuthenticationManager.BuildVirtualUser($"domain\\{username}", true);
//setup custom properties we want in user
virtualUser.Profile.Name = memberData.FirstName;
virtualUser.Profile.FullName = $"{memberData.FirstName} {memberData.LastName}";
virtualUser.Profile.Save();
AuthenticationManager.LoginVirtualUser(virtualUser);
However, the AuthenticationManager
class doesn't have a persistent option for logging in virtual users. Is there a reason why persisting virtual user logins is bad/unsupported? What is the recommended workaround? I'm guessing I'll need to setup a concrete membership provider but wanted to see if there is another viable workaround.