Configuring Single Sign-On with DotNetNuke

  • This is from Eric A. Duncan posted elsewhere on cs.org and re-posted here to support Forum FAQs.

    As a sidenote, the Roles Provider is not at issue here.  The Custom Cookie Authentication does not care what the RolesProvider values are set to.  The RolesProvider is only used for the ASP.NET Forms Authentication, which both DNN and CS does use - but in different ways.

    You will use the Custom Cookie Authentication (instead of ASP.NET Forms Authentication, which would not work in this case.)  Just to be clear, make sure your license is for Custom Cookie Authentication and that you are configuring CommunityServer to use Custom Cookie authentication via the Security Modules download/package.

    In DotNetNuke, you will have to create the custom cookie manually in code.  This cookie is read by CommunityServer and logs the user in automatically, as well as creating the account if need be.

    The easiest place to do this is in the Global.asax file for your DNN Web Application.  Tie into the Authenticate_Request() method, which should only fire when the user is attempting to login. At this point you will create a cookie in code matching the paramters you set in the CommunityServer.config file (Cookie name, Username name, Email name).

    You can test your settings with the TestAuth.aspx file that ships with the Security Modules.  Just place this file in your CS directory and login with it to ensure your CS is setup properly.

    Then all you have to do is to create the cookie manually within your DNN on sign-in, and that should be it.

  • Dave....  Are you sure you cant just make this work by installing both in the same database? 

    Since DNN3 and CS 2.0 can both use the ASPNET 2.0 Membership schema, they should be able to share logins by default...

    With CS 1.X (and probably still currently) we had an issue with the timezone in the profile, that required a code tweak...  (I forget exactly, but one of us used and int of minutes offset from gmt, and the other used a float of hours...)

    Now I am not saying integration would be a piece of cake...  Installing DNN, then CS in the same database, using the CS2 binaries for ASPNET 2, and then configuring CS2 to use the 2.0 membership is not really a beginner CS task...  just I would be surprised if it didn't work...

    Dan

  • Dan,  Thanks for your thoughts on this!

    According to more stolen Duncan bits, "DNN and CS can not live together in the same Web Application name space.  This is because DNN and CS use the ASP.NET iPrincipal and Ticket differently (they store different elements in the common properties in the iPrincipal from what we store).  Most DNN users are using the Custom Cookie authentication module - which allows their DNN users to access the CS site under a single sign-on."

     

  • Dave could you post an example of the Authenticate_Request() method in the DNN 4.x Global.asax file so I can create my custom cookie for CS 2.0

    Thank you,

     

    Bryan

  • I was able to configure it under DNN 4.3.2 and CS 2.0

    On the dnn side in the signin.aspx.vb

    Add to the Private Sub cmdLogin_Click ...

    Else 'Login Success
    If loginStatus = UserLoginStatus.LOGIN_SUCCESS Then
    Dim strUserID As String
    Dim strEmail As String
    strEmail = objUser.Membership.Email.ToString
    strUserID = txtUsername.Text
    Response.Cookies("CSUser"Wink("username"Wink = strUserID
    Response.Cookies("ICVUser"Wink("emailAddress"Wink = strEmail
    End If
    UserAuthorized(objUser, False) 'make sure this runs after your custom cookie or it will not be created.
    End If

     

    Bryan

  • bhughes1231:

    I was able to configure it under DNN 4.3.2 and CS 2.0

    On the dnn side in the signin.aspx.vb

    Add to the Private Sub cmdLogin_Click ...

    Else 'Login Success
    If loginStatus = UserLoginStatus.LOGIN_SUCCESS Then
    Dim strUserID As String
    Dim strEmail As String
    strEmail = objUser.Membership.Email.ToString
    strUserID = txtUsername.Text
    Response.Cookies("CSUser"Wink("username"Wink = strUserID
    Response.Cookies("ICVUser"Wink("emailAddress"Wink = strEmail
    End If
    UserAuthorized(objUser, False) 'make sure this runs after your custom cookie or it will not be created.
    End If

    And, that is all? 

  • How can we share roles between DNN and CS? It's easy to share Authentication, but I need to have Roles and Membership managed on the DNN side and then have CS understand this.

     

    Patrick