Where is Microsoft.Sharepoint.Portal.SingleSignon.dll in SharePoint 2010?
’¦ in SharePoint 2007
SharePoint Server 2007 comes with a single sign-on storage for storing external credentials for connecting with other systems. A poor man's SSO if you can say so (as it's not really based on claims) : but it worked. The functionality was accessible programmatically through Microsoft.SharePoint.Portal.SingleSignon namespace.
’¦ in Sharepoint 2010?
I had to reuse some of this functionality and no longer able to find the dll in SharePoint Server 2010.
So apparently Microsoft had decided to deprecate the library altogether and replace it with Secure Store Service class library. From the API, the major difference seem that it has support for claim based authentication (: but I'm no SharePoint expert. This is probably one of the shared service that are consolidated in Sharepoint 2010).
’¦ the DLLs
You will be needing 2 dlls which both live in the GAC
- Microsoft.Office.SecureStoreService.dll
for me it's stored in: C:\Windows\assembly\GAC_MSIL\Microsoft.Office.SecureStoreService\ 14.0.0.0__71e9bce111e9429c\Microsoft.Office.SecureStoreService.dll - Microsoft.BusinessData.dll
for me it's stored in: C:\Windows\assembly\GAC_MSIL\Microsoft.BusinessData\ 14.0.0.0__71e9bce111e9429c\Microsoft.BusinessData.dll
Note: I can't seem to reference these 2 dlls straight from VS2010. So what I had to do was open up a command line console and copy the 2 dlls into my project. I'm sure there's a better way of doing this : this works but not future proof (you should really reference the installed SharePoint dlls in the GAC)
’¦ using it
Here's a code snippet on how to get user credentials using the default secure store provider.
Notice that the credential information is now stored as a collection and you have to loop through to get all the values.
foreach (SecureStoreCredential cred in creds) { //... switch (cred.CredentialType) { case SecureStoreCredentialType.UserName: if (userName == null) { userName = GetStringFromSecureString(cred.Credential); } break; case SecureStoreCredentialType.Password: if (password == null) { password = GetStringFromSecureString(cred.Credential); } break; case SecureStoreCredentialType.Pin: if (pin == null) { pin = GetStringFromSecureString(cred.Credential); } break; } }
I can't seem to find a good example of storing into SecureStore yet.
Update [15/09/2010]: So I just work out that one wouldn't normally set the credential programmatically, but instead redirect the user to the Form.
In SharePoint 2007 the Url to the form is retreived by calling:
SingleSignonLocator.GetCredentialEntryUrl(‘SomeApplicationId’)
In Sharepoint 2010, this is a part of the responsibility of SecureStoreProvider, which becomes
_storeProvider.GetCredentialManagementUrl("someApplicationId"
It's probably worth noting that the method isn't a part of the ISecureStoreProvider. So when you're using a custom secure store, you don't have access to this method. It's a part of another Interface which is ICredentialEntry
Thanks Ronald.