Add to My Yahoo! | Google Reader or Homepage | Add to Windows Live | Add to Windows Live Alerts

Wictor Wilén

Microsoft Certified Master (MCM) - SharePoint 2010 | Microsoft Most Valuable Professional (MVP) - SharePoint Server MVP | Author

Using custom authentication provider users in SharePoint Timer Jobs

Posted at 2009-09-01 07:54 by Wictor Wilén in SharePoint with 4 comments.

Today I stumbled upon Yet Another SharePoint Problem (YASP) with a custom timer job. The custom timer job is supposed to synchronize some user information between site collections (on a WSS 3.0 installation). In some cases the timer job has to add users to site collections. Sounds like a no-brainer, right!

The problem is that we are using this installation as an internet facing site and the external users are stored in AD LDS (Active Directory Lightweight Directory Services, formerly known as ADAM) and our own custom authentication provider.

When the timer job was running it found users in one site collection and could not add them to the other site collections, using EnsureUser(). It just threw an exception and stated that it could not locate the user.

We made sure we had the right privileges, that the timer service was running under correct account etc. Finally we hooked up the debugger and set some breakpoints in our custom authentication provider to see where it failed when it tried to resolve the users. But the Visual Studio debugger never loaded our provider assembly!

Then it struck me; how would the OWSTimer.exe know what assembly our custom authentication provider is located in, in Central Administration you only specify the name/prefix of the forms authentication provider. The definition for the custom authentication provider is only specified in the web.config of our web application.

So we added a configuration file to the OWSTimer.exe, called OWSTimer.exe.config and specified the authentication provider, see below. Then after a restart of the service, everything worked like a charm.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.web>
    <membership defaultProvider="TODO">
      <providers>
        <!-- Add providers here -->
      </providers>
    </membership>
  </system.web>
</configuration>

Everyday with SharePoint gives you new obstacles…

Comments and trackbacks

#  Everyday with SharePoint gives you new obstacles… by The half full glass (aka, Wouter)
Screenshot from websnpr Obstacles you would have had anyway ;) We are so spoiled :)
#  @Wouter by Wictor
Screenshot from websnpr Yea, how fun is it when everything goes your way. What would you do with all the time!
#  by
Screenshot from websnpr You saved my weekend=)
#  Web services by Gaurav
Screenshot from websnpr The other alternative would be to move your methods from the timer job to a web service...
Make a comment on this post:
Subject:  

Your name:  
Your Url:  
Note: submissions may have to be approved before being visible, so don't submit your comment multiple times.