SiteMinder and SharePoint 2007

by shuff 4/24/2007 6:35:00 AM

**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

Tags:

Simply Sudoku

by shuff 4/7/2007 11:34:00 AM
I've been working on a version of Sudoku written in vb.net. The beta version is ready for use and can be downloaded here:

http://www.huffs.us/ss/sudokusetup.msi

Please send me feedback on it at the contact page: http://www.huffs.us/blogEngine/contact.aspx

Thanks!!

Tags:

Powered by BlogEngine.NET 1.5.0.7
Theme by Mads Kristensen

About the author

Name of author Steve Huff
A developer in the Greater Cincinnati/Northern Kentucky area.

E-mail me Send mail

Recent comments

Authors

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2010

Sign in