kurt.schindler-adaptdev
-
11/11/2013 2:30:34 PM
Help with multiple membership providers
What do I need to know about using multiple membership providers in a Kentico site? Gotchas, issues?
Here's the scenario: I'm partially converting a large asp.net site to Kentico. Kentico will manage users/roles as far as typical CMS logins go. But this site also has a large "members only" section of pages that we are not migrating into Kentico, per se (they are just aspx pages within the website). This membership data resides in a database separate from the Kentico cms database.
We need to have 1 universal login form for either CMS users or non-cms "members". And Kentico needs to know when a particular non-cms "member" is logged in (and what roles they may have). Certain Kentico-based pages do need to know whether the current user is logged in as a member or not, even though Kentico itself doesn't manage these members...
I've implemented a CustomAuthenticationProvider via the CMSModuleLoader paradigm. It's working as expected. If user logs in and it matches a Kentico login, the User object will be hydrated when my custom provider runs, so I just return. If user is null, then I can access the other membership provider and query to determine if the credentials match a "member" and create and return a UserInfo object instead.
Questions:
- Are there any pitfalls with this approach? - Will I be able to access the User info and roles from the currently logged in user from with Kentico, regardless of which membership store they came from?
thanks in advance for any assistance.
|