I\'m trying to implement a really really simple MembershipProvider for sitecore, but i\'m not sure if it\'s too simple to actually work. Basically we already have a
Implementing a membershipprovider is a lot of work for what you seem to need. If I were you I would implement a scenario, where you create a virtual user everytime someone needs to be logged in. So the logic would be to check if a user has your token, then create a virtual user, log the virtual user in and you should be good to go.
Here is a guide on the virual user thingie: http://sdn.sitecore.net/Articles/Security/Faking%20user%20roles/Virtual%20user.aspx
EDIT: The code in the link is depricated. Here is how you add virtual users:
userName = "extranet\\"+userName
User userItem = AuthenticationManager.BuildVirtualUser(userName, true);
userItem.Profile.Initialize(userName, true);
userItem.Profile.Email = userName + "@yourdomain.com";
userItem.Profile.Save();
AuthenticationManager.Login(userItem.Name)
EDIT 2: I have the following code:
public class TestVirtualUserProcessor : HttpRequestProcessor
{
public override void Process(HttpRequestArgs args)
{
HttpContext.Current.Response.Write(Sitecore.Context.User.Name + "
");
HttpContext.Current.Response.Write(Sitecore.Context.User.IsAuthenticated + "
");
CreateVirtualUser("jenneren");
HttpContext.Current.Response.Write(Sitecore.Context.User.Name + "
");
HttpContext.Current.Response.Write(Sitecore.Context.User.IsAuthenticated + "
");
}
private static void CreateVirtualUser(string name)
{
string userName = "extranet\\" + name;
User userItem = AuthenticationManager.BuildVirtualUser(userName, true);
userItem.Profile.Initialize(userName, true);
userItem.Profile.Save();
AuthenticationManager.Login(userItem.Name);
}
}
This outputs the following the first time I hit the frontend:
extranet\Anonymous False extranet\jenneren True
And the second time I hit the frontend I get:
extranet\jenneren True extranet\jenneren True
So it should work. Cheers Jens