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;
        }
Example #2
0
        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);
        }