@Brandon: "avoid that perilous core change!"
That sounds like good advice. I have therefore abandoned the core change and created a wrapper around AspNetMembershipProvider - it looks like I will end up with a Decorator Pattern as I can envisage needing various versions for upcoming clients, and sometimes pipelined authentication (ip, referer, client web service...). I think - as you have found with your implementations - that interaction with the external resource will involve more than just validation.
(Note: I initially avoided a wrapper as I was too lazy to create all the plumbing needed, but it turns out that ReSharper makes it dead easy:-)
I would be very grateful if you have any pointers on how to:
a) Create a new user on the fly if the external resource validates and a DNN account doesn't exist yet
b) Add the user to externally supplied roles.
I have sort of done the roles part, but I need to reload the application to see the effect . Also, I know something isn't quite right as my simplistic approach causes a crashing problem with the RoleController. It is almost certainly my lack of understanding at this level of detail that is the problem. Here is my (test) code :
Neil
internal void UpDateRoles(int portalId, UserInfo user)
{
if (!user.IsInRole("Member"))
{
RoleController controller = new RoleController();
RoleInfo roleInfo = controller.GetRoleByName(portalId,"Member");
controller.AddUserRole(portalId, user.UserID, roleInfo.RoleID,System.DateTime.Now);
controller.UpdateRole(roleInfo);
}
}