private static IAuthenticationProvider DiscoverProvider(IEnumerable<Type> discoveredProviders, ProviderKey providerKey)
        {
            var name = providerKey.Name.ToLowerInvariant();

            var provider = discoveredProviders.SingleOrDefault(x => x.Name.ToLowerInvariant().StartsWith(name));

            if (provider == null)
            {
                throw new ApplicationException(
                    string.Format("Unable to find the provider [{0}]. Is there a provider dll available? Is there a typo in the provider name? Solution suggestions: Check to make sure the correct dll's are in the 'bin' directory and/or check the name to make sure there's no typo's in there. Example: If you're trying include the GitHub provider, make sure the name is 'github' (any case) and that the ExtraProviders dll exists in the 'bin' directory.",
                                  name));
            }

            var parameters = new ProviderParams
            {
                Key = providerKey.Key,
                Secret = providerKey.Secret
            };

            return Activator.CreateInstance(provider, parameters) as IAuthenticationProvider;
        }
コード例 #2
0
 public FacebookProvider(ProviderKey providerKey,
                         IList<string> scope = null,
                         IRestClientFactory restClientFactory = null) :
                             this(providerKey.Key, providerKey.Secret, scope, restClientFactory)
 {
 }
 public TwitterProvider(ProviderKey providerKey, IRestClientFactory restClientFactory = null)
     : this(providerKey.Key, providerKey.Secret, restClientFactory)
 {
 }
コード例 #4
0
ファイル: FlickrProvider.cs プロジェクト: Gutek/wd_providers
 public FlickrProvider(ProviderKey providerKey
     , string perms = null
     , IRestClientFactory restClientFactory = null)
     : this(providerKey.Key, providerKey.Secret, perms, restClientFactory)
 {
 }
 public GoogleProvider(ProviderKey providerKey,
                       IList<string> scope = null, IRestClient restClient = null)
     : this(providerKey.Key, providerKey.Secret, scope, restClient)
 {
 }
コード例 #6
0
 public FacebookProvider(ProviderKey providerKey, Uri redirectUri,
                         IList<string> scope = null, IRestClient restClient = null) :
                             this(providerKey.Key, providerKey.Secret, redirectUri, scope, restClient)
 {
 }
コード例 #7
0
 public TwitterProvider(ProviderKey providerKey, Uri redirectUri, IRestClient restClient = null)
     : this(providerKey.Key, providerKey.Secret, redirectUri, restClient)
 {
 }