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;
        }
 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)
 {
 }
Esempio n. 4
0
 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)
 {
 }
 public FacebookProvider(ProviderKey providerKey, Uri redirectUri,
                         IList<string> scope = null, IRestClient restClient = null) :
                             this(providerKey.Key, providerKey.Secret, redirectUri, scope, restClient)
 {
 }
 public TwitterProvider(ProviderKey providerKey, Uri redirectUri, IRestClient restClient = null)
     : this(providerKey.Key, providerKey.Secret, redirectUri, restClient)
 {
 }