1

My requirement is this:

I have a DNN website www.websiteA.com.

I want to build www.websiteB.com and www.websiteC.com on the same DNN installation. www.websiteB.com and www.websiteC.com should allow users of www.websiteA.com to login with the same username and password.

When a user logs in to www.websiteA.com, and then navigates to www.websiteB.com or www.websiteC.com, they shouldn’t have to login again as they are already logged in to the main website.

I found modules that will let me share users between these websites, such that they can login to any of the three websites using the same credentials. However, I cannot find a way to login a user to all websites simultaneously, so that the user does not have to login again.

I would prefer to do this without modifying the DNN source too much. Since all three websites are on the same DNN installation, I was hoping there would be a way to share authentication cookies, but I haven't found any yet.

Can anyone provide me more direction in this matter? Thanks!

Apeksha
  • 485
  • 6
  • 23
  • You may want to look at the paid versions of DNN. – Chris Hammond Sep 04 '15 at 20:18
  • Thanks @ChrisHammond I read that Evoq provides SSO using Active Directory. If that is true, then it won't fit our requirements. Do you know if it can work without AD? – Apeksha Sep 04 '15 at 21:24
  • @ChrisHammond I looked into it more and found that paid versions of DNN have a feature to create site groups, which will enable user sharing - letting users of master website log in to child websites with same credentials. What I am looking for is that users do not need to login to child websites once logged in to master. I can't find a definitive answer on whether this is supported or not. Could you please help? – Apeksha Sep 04 '15 at 22:47
  • Unfortunately to do that, you'll need to figure out how to get the sites to all share a cookie. If you're doing it with Subdomains, all off the same top level domain it isn't too difficult, otherwise, I don't know how to do it – Chris Hammond Sep 05 '15 at 00:42

2 Answers2

2

I did this exact thing for two clients using the Site Groups feature but it required the caveat as in the above comments. You must use a child aliases for your other portals so that they are all on the same domain. That is key so that the user's session cookie can be used across portals.

So this is how I setup the portal aliases:

  • websiteA = portal 0, alias websiteA.com (Primary)
  • websiteB = portal 1, alias websiteA.com/b (Primary) and alias websiteB.com redirect alias
  • websiteC = portal 2, alias websiteA.com/c (Primary) and alias websiteC.com redirect alias

The Site Groups user interface to manage the groups is an Evoq feature, but the backend is a core platform structure.

Here is how you would configure it without the UI in DNN Community:

Create a record in PortalGroups table: MasterPortalID = 0, PortalGroupName = 'WebsiteA Group', AuthenticationDomain = 'websiteA.com'

Now update the PortalGroupID field in the Portals table:

  • WHERE PortalID = 0, SET PortalGroupID = -1
  • WHERE PortalID = 1, SET PortalGroupID = 1 (assuming the new PortalGroupID you added was 1)
  • WHERE PortalID = 2, SET PortalGroupID = 1
Fix It Scotty
  • 2,852
  • 11
  • 12
2

Another thing you could do is write your own custom DNN Authentication Provider (http://www.dnnsoftware.com/community-blog/cid/134678/dotnetnuke-tips-and-tricks-12-creating-your-own-authentication-provider).

Then, just have the authentication provider check an authentication cookie on the user's system. If the cookie is valid (and not expired), you can automatically log them in. Otherwise, redirect them to the main login screen. I did this, but the other site was a Java based dashboard.

L_7337
  • 2,650
  • 28
  • 42
  • How do I check an authentication cookie belonging to a different domain? I thought that was not allowed. Sorry if I'm missing something obvious. – Apeksha Sep 10 '15 at 16:06
  • Maybe I mis-worded that. I just created a general purpose cookie and used it for authentication. – L_7337 Sep 10 '15 at 16:25
  • Thanks, I understand now. That brings me to the question - I will have to read this cookie as soon as the website is loaded. The custom authentication provider will only be on the login page. So in order to be logged in automatically, user has to navigate to the login page? Could you please provide more detail on how your solution works? Thanks a lot for your inputs! – Apeksha Sep 10 '15 at 16:31
  • 1
    Sorry, its been a while so I forgot some of the details. Basically, I created a DNN module that checks/refreshed the cookie. In DNN, there is a way to say "Add this module to every page". The module has no UI, so you don't even see it. So, the cookie is getting refreshed every time the user navigates to any page. Then, the custom auth provider checks this cookie. I have a little more description in this answer: http://stackoverflow.com/questions/21131243/using-dnn-authentication-and-authorization-info-from-another-asp-net-app/21163878#21163878 – L_7337 Sep 10 '15 at 17:09
  • 1
    Also, when the user logged in it created a Token in a table with an expiration date. This is what was used to make sure they didn't stay logged in constantly. The module would update the expiration of the token in the database. I also described it in this question: http://stackoverflow.com/questions/18621303/dnn-single-sign-on-through-webservice/18643254#18643254 – L_7337 Sep 10 '15 at 17:17
  • Thank you very much! But I am still looking for a way to read cookie from another domain. If website A creates a cookie - any cookie - how can website B read it? All I am reading online is that cookies are only available to the domain that created them. – Apeksha Sep 10 '15 at 19:23