Dave Burke : Online Community and Social Business Specialist

Email Considerations with Community Server Single Sign-On

I had to add this fix for a new Community Server site launch this fine Super Bowl Sunday so I thought I might as well blog about it.  It's also an important issue when using Community Server Single Sign-On.

Single Sign-On automatically creates new user accounts in a Community Server community with the primary membership stored in another application and data source, typically a parent ASPNET site.  This works great, but emails are created as [username] + @localhost.com, or daveburke@localhost.com. 

What problem might this produce on the community site?  Quickly now...Correct!  Site-specific email functions are hosed.  This means when using a Single Sign-On configuration with Community Server you want to reproduce the user email addresses from the main membership data source in the site’s ASPNET_Membership and cs_users tables.

One way to achieve this is creating a CSModule to update the email addresses when an account is created in the child community site.  The module itself is very simple and looks like this.




Hidden in the simplicity of the module is a requirement of a second Data Provider for the main membership data source.  You can see how the email is obtained from the originating data source from the provider I named "HomeDataProvider" then passed to a local stored procedure with the "DRIVEDataProvider."




The good news is that if you're using the Drive Framework, the HomeDataProvider classes are generated for you, as is the code to retrieve and update the code in the two databases with one of Drive’s Composite CodeSmith Templates.  The DRIVEUsers.cs class and CreateDRIVEUser CSModule are included in the Drive Project Setup templates, so most of the work there is done as well.  Then all we have to do is update the communityserver_override.config, add the connection string in connectionstring.config, upload the fresh DLLs, and bill the client your Super Bowl Sunday hourly rate.

Comments (2) | Post RSS RSS comment feed

Posted on 2/1/2009 3:13:56 PM by Dave Burke
Categories: Community Server | CodeSmith
Tags:

Related posts

Comments (2) -

2/4/2009 12:14:14 PM Permalink

Dave,

Actually, the username@localhost.com is basically a last resort.  The Forms Authentication module has always had it so you can pass the user's email address in a separate cookie from the parent site.  The @localhost.com bit is mainly there for when the cookie doesn't exist.  To create the user, it needs an email address, so the option is use that, or throw an error to the user.

There is documentation on the SSO modules in multiple places, such as on the website and in the download, and some old documentation from previous versions on the website.  The documentation with the download details it and the included formsauthtest.aspx page shows sample code for setting the cookie.

In CS 2008, you can actually pass in almost *any* user profile information with that cookie, so you can also fill display name, timezone, preferences, and even roles.  I should do a blog post about that.

Ken

Ken Robertson United States |

2/4/2009 12:57:54 PM Permalink

The parent site is also a CS site, so I wasn't thinking of needing to customizing the cookie using Forms Authentication, though I've actually done it before on non-CS sites with cookie-based SSO configs.  You're right about the download SSO docs.  Always excellent.

Thanks for the correction and I hope my grovelling is accepted. Smile


Dave Burke United States |


Powered by BlogEngine.NET 2.0.0.36
Theme by Dave Burke

Copyright © 2013 Dave Burke.  All Rights reserved.