**EDIT**
I recieved the following note from Jim Thorstad at CA:
"Hi Steve and all, on February 5, 2010 CA announced CA SiteMinder Agent for SharePoint. See http://www.ca.com/us/products/product.aspx?ID=8374 for more information. This is the prefered way to integrate CA SiteMinder and SharePoint. A number of features are supported including Windows impersonation for AD users and client integration for non-AD users."
The orginal Blog post is below:
We've been working on a project at work to integrate SiteMinder with SharePoint 2007. Basically we wanted a person to be prompted once by SiteMinder for there credentials and then enter into SharePoint 2007 and have SharePoint automatically log them in.
Our SiteMinder setup is puling from LDAP and we have SharePoint setup using Form authentication against the same LDAP database.
Solution:
We created a HTTP Module in VB.NET that grabs the SMUSER from the HTML Header that SiteMinder creates and created a GenericPrincipal user that is then used for the Forms authentication. If the user is at the login.aspx page then we simly call the FormsAuthentication.RedirectFromLoginPage method and SharePoint logs the user in.
Feedback on the code is welcome. The complete VB.NET module code follows. Keep in mind that the HTTP Module needs to be setup in SharePoints Web.Config file and needs to run with Full Trust. The easiest way to do this is to put the DLL in the GAC.
The meat of the code is in OnPreRequestHandlerExecute. BTW - Blogger does not allow me to format the code very nicely, sorry about that.
HTTP Module Code follows:
Imports System
Imports System.Web
Imports System.Collections.Specialized
Imports System.Security.Principal
Imports System.Threading
Namespace smfrmauth
Public Class SMFrmAuth : Implements IHttpModule
Public Sub Dispose() Implements System.Web.IHttpModule.Dispose
'Place Holder
End Sub
Public Sub Init(ByVal httpApp As HttpApplication) Implements IHttpModule.Init
AddHandler httpApp.BeginRequest, New EventHandler(AddressOf OnBeginRequest)
AddHandler httpApp.EndRequest, New EventHandler(AddressOf OnEndRequest)
AddHandler httpApp.BeginRequest, New EventHandler(AddressOf OnAuthenticateRequest)
AddHandler httpApp.PreRequestHandlerExecute, New EventHandler(AddressOf OnPreRequestHandlerExecute)
End Sub
Public Sub OnBeginRequest(ByVal o As Object, ByVal ea As EventArgs)
'Place Holder
End Sub
Public Sub OnEndRequest(ByVal o As Object, ByVal ea As EventArgs)
'Place Holder
End Sub
Public Sub OnAuthenticateRequest(ByVal o As Object, ByVal ea As EventArgs)
'Place Holder
End Sub
Public Sub OnPreRequestHandlerExecute(ByVal o As Object, ByVal ea As EventArgs)
'Get a collection of all available HTTP headers from the request
Dim col1 As NameValueCollection = HttpContext.Current.Request.Headers
'Retrieve the userid from the Siteminder header SMUSER
Dim SMUSER As String = col1("SMUSER")
Dim roles As String() = Nothing
Dim webIdentity As New GenericIdentity(SMUSER, "Form")
Dim principal As New GenericPrincipal(webIdentity, roles)
HttpContext.Current.User = principal
Thread.CurrentPrincipal = principal
If InStr(HttpContext.Current.Request.Url.ToString, "login.aspx") Then
System.Web.Security.FormsAuthentication.RedirectFromLoginPage(HttpContext.Current.User.Identity.Name.ToString, False)
End If
End Sub
End Class
End Namespace