Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0DNN 4.3.4 Membership Provider modelDNN 4.3.4 Membership Provider model
Previous
 
Next
New Post
8/18/2006 6:24 AM
 

The abstract provider is built the way it is to integrate w/ these DNN data store specific items. AT some point, there must be a way to 'bring together' these items as DNN must be able to extend the user, role, profile providers beyond what is available in the Member Role implementations. There is no difference here from how CS byTelligent does (in terms of general concept).

If you want 2 DNN installations to share the same user store, you need to do two things: Make use of object qualifiers, differing between your DNN installations. You also need to use the AspNET profile provider, and not the new default DNNProfileProvider. If you change this provider, you could theoretically integrate with other asp.net applications like Community Server, which also use this provider model and concrete provdier. (I do not follow CS, so I am not sure if they have changed this recently). You discussion of your scenario is not clear to me, and I almost feel that you are talking about portals. To be clear here, if you have two dnn installs it will never be possible to run them from a seperate database from one another and share this aspnet membership base (unless you make core changes and add a connection string specifically to handle this). This is no different than any other aspnet application, the two applications have to use the same database to share this datastore data.

You can currently use the aspnet membership in DNN and take advantage of Active Directory, this will 'sync' dnn user information up for you. This could easily be extended to add various options if one were so inclinded to do so. This would not require any changes from existing providers for Membership Services today.

To be clear, in a provider model you should NEVER have direct calls to concrete provider specific datastore items via the abstract provider. WHen you are talking about the web.config provider changes, I want to make sure that you MUST set this prior to installation of your DotNetNuke site. I have changed the default profile provider prior to installation and seen this work 100% properly. I have also done this with the Membership Provider. You MUST remember, your concrete implementation must adhere to the abstract API to ensure this happens properly at time of install. Because you can change the profile provider to the aspnet one prior to install, there is no 'compatibility' break.

As for your questions:

a - I am still not 100% clear on 'lazy' synch and what you think this really is. I think that your real problem here might be that you need to change the profile provider (possibly roles too, didn't check) in your web.config prior to installation. Since this can be done, there are no plans to change this or further the asp.net concrete provider.

b - I don't understand why changes would be needed at this point. If you need to 'authenticate' against a seperate data store, you would need to create a new authentication provider.

c - The code for this is part of the aspnet membership project. Provider.Membership.AspNetProvider. Since these are all the MS implementation, it was decided to group them as one codebase to keep the project number down at least a bit here. This means you point all your providers in web.config to this, you will be running the same stuff as in 4.0.3.

d - This also exists already. The code is also in the Provider.Membership.AspNetProvider project.

To be clear Matt, I am not 'calling you out' or anything like that. I feel that you know programming and understand many things about the provider model and aspnet implementations but I think there is some misunderstanding about the DNN implementations.


Chris Paterra

Get direct answers to your questions in the Community Exchange.
 
New Post
8/20/2006 10:57 PM
 

I'm not talking about inheriting from the asp.net concrete providers, I'm talking about inheriting from the abstract class System.Web.Security.MembershipProvider/RoleProvider/ProfileProvider

http://msdn.microsoft.com/asp.net/downloads/providers/default.aspx?pull=/library/en-us/dnaspp/html/ASPNETProvMod_Prt1.asp

This is what the AspNetMembershipProvider inherits from.

I've actually taken the AspNetMembershipProvider database out of the equation by completely rewriting the DNNMembershipProvider into my own customProvider and that changing the web.config to use the new providers, I'll admit I still use the class to get some simple configured properties and do some calls to things like Generate Password etc, but I've deleted the tables and the stored procedures that this thing was using, As I don't need them because we have our own user database that we want to plug in to.

 Basically the DNN  Membership/Role/Profile Providers classes could be defined something like.

Public MustInherit Class DotNetNuke.Security.Membership.MembershipProvider Inherits System.Web.Security.MembershipProvider

and same with Role and Profile.

That way the DNNMembershipProvider inherits from DotNetNuke.Security.Membership.MembershipProvider and you have the best of both worlds. The DNNMembershipProvider can be used by Microsoft Controls and DNN controls.

And if a user has written a Provider that was working with microsoft controls. They can just change the class definition to inherit from DotNetNuke.Security.Membership.MembershipProvider instead of Microsoft.Web.Security.MembershipProvider and they only have to implement the new DotNetNuke Provider methods that are in the DNN abstract class (DotNetNuke.Security.Membership.MembershipProvider,  which inherits from the Microsoft one)

I'm not sure either of you fully understand the ProviderModel / Abstract classes, but this is how I see it:

I have an abstract class called a MembershipProvider. It has some methods defined, such as:

public abstract MembershipUser GetUser (object providerUserKey, bool userIsOnline);
public abstract MembershipUser GetUser (string username, bool userIsOnline);
public abstract string GetUserNameByEmail (string email);

Now in the case of DNN we need a portalId, so we add these methods to our MembershipProvider that inherits from the above provider.

public int PortalID;
public abstract UserInfo GetUser (int portalId, object providerUserKey, bool userIsOnline);
public abstract UserInfo GetUser (int portalId, string username, bool userIsOnline);
public abstract string GetUserNameByEmail (int portalId, string email);

We inherit from the abstract DNNProvider and add our code.

 

public abstract MembershipUser GetUser (object providerUserKey, bool userIsOnline);
{
   return MembershipUser = GoAndGetAMembershipUserFromTheDatabaseThatBelongsToThisPortal(this.PortalID,  (int)providerUserKey);

}

public override UserInfo GetUser(int portalId, object providerUserKey, bool userIsOnline)
{
   //I would probably write this to re-use the original Microsoft Provider methods as much as possible:
   this.PortalId = portalId;
   MembershipUser mu = GetUser (object providerUserKey, bool userIsOnline);
   return CreateUserInfoFromMembershipUser(mu);

   'Maybe I want all my portals to share the same user Database, so I don't care about the portal Id.
   //ignore the portalId.
   
MembershipUser mu = GetUser (object providerUserKey, bool userIsOnline);
   
return CreateUserInfoFromMembershipUser(mu);

   'Maybe I want to call a web service or read a text file to get my user information.
   return GoAndDoWhateverButAtLeastReturnAUserInfo();

}

I hope that makes sence.

 

 

Also I noticed that a lot of the DNNProvider methods return ArrayLists, I've been using the new (introduced in .NET 2.0)System.Collections.Generic namespace and it would be a good Idea to use that instead of ArrayLists when defining abstract methods e.g.

public override ArrayList GetUsersByUserName(int portalId, bool isHydrated, string userNameToMatch, int pageIndex, int pageSize, ref int totalRecords)

could be

public override List<UserInfo> GetUsersByUserName(int portalId, bool isHydrated, string userNameToMatch, int pageIndex, int pageSize, ref int totalRecords)

Which basically means The list can only contain UserInfo objects, it's much easier to write your providers this way as you know exactly what type of objects the List is supposed to contain and what the method should return.

 

Cheers,

 

 

 
New Post
8/21/2006 5:24 AM
 

Hehe, im all ok, I like that I get some good responses here now. Now we just have to understand eachother better! Mind "just" haha..

The abstract provider is built the way it is to integrate w/ these DNN data store specific items. AT some point, there must be a way to 'bring together' these items as DNN must be able to extend the user, role, profile providers beyond what is available in the Member Role implementations. There is no difference here from how CS byTelligent does (in terms of general concept).

Im not sure I completely understand what u mean here, but im assuming that by "DNN data store specific items" you are talking about whatever database items, being it core modules or 3rd party, that is refering to a user. Specifically, by having a userId column in their table.

With that assumption made... I do see *why* its done this way, but for the provider abstract implementation to make assumptions like that regarding the concrete implementation's data store forces that providers datastore's schema to look a certain way. A schema that most often would already exist in the time of the programming of the DNN provider for it. I think logic like that is better placed in the app's core, and not in a data store specific provider layer. Like stated, if I was to make an LDAP provider (Or any other implementation where the already existing data store doesnt have a user identification value of type Integer), I can impossibly do that without maintaining a local data store aswell.

In order to explain the different problems I have we'v gone knee deep in different theoretical programming technieque's. That was not my intention. All I really need to know is your (DNN dev's) thoughts about, and future plan, was for this provider model, so I can make my implementation according to that. If this is the final version, so be it.

If you want 2 DNN installations to share the same user store, you need to do two things: Make use of object qualifiers, differing between your DNN installations. You also need to use the AspNET profile provider, and not the new default DNNProfileProvider. If you change this provider, you could theoretically integrate with other asp.net applications like Community Server, which also use this provider model and concrete provdier.

c - The code for this is part of the aspnet membership project. Provider.Membership.AspNetProvider. Since these are all the MS implementation, it was decided to group them as one codebase to keep the project number down at least a bit here. This means you point all your providers in web.config to this, you will be running the same stuff as in 4.0.3.

Im trying to understand what u mean by "the AspNET profile provider". Assuming you mean the AspNetProfileProvider the  "Abstracting the Membership and Profile Components _3.3_.pdf" document talks about, I can not find it. Specifically, opening the 4.3.4 project source code, I can not find the AspNetProfileProvider class in Provider.Membership.AspNetProvider.

You discussion of your scenario is not clear to me, and I almost feel that you are talking about portals

To clarify, im not talking about portals! =)

To be clear here, if you have two dnn installs it will never be possible to run them from a seperate database from one another and share this aspnet membership base (unless you make core changes and add a connection string specifically to handle this). This is no different than any other aspnet application, the two applications have to use the same database to share this datastore data.

I am assuming you are talking about when using the aspnet default concrete implementations of the aspnet abstract provider. In 4.0.3, you could add a connection string and then set the connectionStringName attribute of the aspnet provider to the name of that connection string, and you could have the asp net provider access whatever datastore u choose. Even one "beloinging" to another DNN installation. And then, at login time, as stated in the "DotNetNuke Membership.pdf" document, there would occur a lazy synch.

You can currently use the aspnet membership in DNN and take advantage of Active Directory, this will 'sync' dnn user information up for you. This could easily be extended to add various options if one were so inclinded to do so. This would not require any changes from existing providers for Membership Services today.

WHen you are talking about the web.config provider changes, I want to make sure that you MUST set this prior to installation of your DotNetNuke site. I have changed the default profile provider prior to installation and seen this work 100% properly. I have also done this with the Membership Provider. You MUST remember, your concrete implementation must adhere to the abstract API to ensure this happens properly at time of install. Because you can change the profile provider to the aspnet one prior to install, there is no 'compatibility' break.

Yes, it would synch the users. Once, at install time. What about users created later in the AD? They would not be able to log in. The quote from the code again:
Line 1334 (or close) in Provider.Membership.AspNetProvider.AspNetMembershipProvider.vb:
'For now, we are going to ignore the possibility that the User may exist in the
'Global Data Store but not in the Local DataStore ie. A shared Global Data Store.

"Global Data Store" is refering to the AD here, and "Local DataStore" the DNN local database.

Ok, now I have another question for you. Is user synch of users at install time all that is intended? Isnt the intention by the provider model to be able to have a shared user data store?
If the answer here is that the users should only synch at install time, then I would think it a compatibilty break between 4.0.3 and 4.3.4, simply because the users were synchronized at login time (and other times aswell) in version 4.0.3. Thats a contrete way, although a bit simplified, of putting it anyway.


a - To understand what im refering to by "lazy" synch, read the document "DotNetNuke Membership.pdf" that was shipped with version 4.0.3.

b - Thats exactly what im doing. And there are problems with implementing that without maintaining a local data store aswell, as stated above.

c, d - See above. I cant find the class AspNetProfileProvider in the code anywhere. Iv searched for it using explorer and VS, but its just not there. Is the source code version iv downloaded incorrect/incomplete? Or maybe u can point me to it.


My solution to my problem for now has been to implement my own providers have been to literally copy the code of the Provider.Membership.AspNetProvider.AspNetMembershipProvider to then modify it to lazy synch the users among other smaller changes. Also, Iv copied and pasted the Provider.Membership.DNNProvider.DNNProfileProvider code, and done the same thing here and by that turning it into a AspNetProfileProvider. And then ofcourse I configure web.config to use these, and my concrete implementaions of the AspNet provider model aswell. Do I like to do it this way? Ofcourse not,


PS. Leafrink, I think your idea is interesting.

 

 
New Post
9/8/2006 4:56 AM
 

Hello!

Some time has passed while my last post remain unanwered. Although iv progressed as explained above, Im still very keen on getting answers to my questions. What iv done is a form of a workaround, not the prefered design, im sure.

a - When understanding what I mean my lazy synch, maybe you have more info for me? Basically, is the intention for the synch to now only occurr at install-time and not run-time?

b - I think iv said my part here about the design, and as I understand it from your answers there's no plans to change it. Thats ok I guess, although Id preferebly see a better design, but I can work with it aslong as I know.

c, d - Still cant find these classes you mention. Can you please point me to them?

Thank you!

 

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0DNN 4.3.4 Membership Provider modelDNN 4.3.4 Membership Provider model


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out