Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Custom Authentication as well as Kentico editors View modes: 
User avatar
Member
Member
ndeych-gmail - 11/23/2011 11:21:12 AM
   
Custom Authentication as well as Kentico editors
I have an external database with a list of users that are going to be considered external. I also have Kentico editors that need to make edits to the content.
How can I achieve both options for logging in?

I am using the custom SecurityHandler class and can authenticate the external users with no problem.

The problem are the Kentico users. If I don't do anything special, they are considered external.
If I try to use Membership.Validate(username), that gets stuck in a loop to use the custom OnAuthentication inside that request. How can I achieve this?

Thanks for any help!

User avatar
Member
Member
nicolas.juteau-nexun - 11/23/2011 1:09:04 PM
   
RE:Custom Authentication as well as Kentico editors
Hello,

In your OnAuthentication method, put this at the beginning of the method:

// Check if the user was authenticated by the system
if (userInfo != null) return userInfo;

When OnAuthentication method is called, if the variable userInfo is not null, that means Kentico found the user in its own membership tables. So return that same userInfo to "bypass" your external database check.

That way, your internal kentico users will be correctly authenticated.

I hope it helps.