User Tools

Site Tools


notes:sharepoint2010:authentication

Authentication Provider in SharePoint 2010

Find an available authentication provider:

using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;
...
SPAuthenticationProvider provider;
var providers = IisSettings.ClaimsAuthenticationProviders.GetEnumerator();
if (providers.MoveNext())
{
    // Get the available authentication provider.
    provider = providers.Current;
 
    string providerName = provider.ClaimProviderName;
}
 
// Get IIS settings of the current zone.
private static SPIisSettings IIS;
private SPIisSettings IisSettings 
{ 
    get 
    {
        if (IIS == null)
        {
            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
              IIS = 
               SPContext.Current.Site.WebApplication.GetIisSettingsWithFallback(SPContext.Current.Site.Zone);
            });
        }
        return IIS; 
    } 
}
notes/sharepoint2010/authentication.txt · Last modified: 2015/06/24 by admin