Ejemplo n.º 1
0
        protected override void ConfigureApplicationContainer(TinyIoCContainer container)
        {
            base.ConfigureApplicationContainer(container);

            //var twitterProvider = new TwitterProvider(new ProviderParams { PublicApiKey = TwitterConsumerKey, SecretApiKey = TwitterConsumerSecret });
            var facebookProvider = new FacebookProvider(new ProviderParams { PublicApiKey = FacebookAppId, SecretApiKey = FacebookAppSecret });
            var googleProvider = new GoogleProvider(new ProviderParams { PublicApiKey = GoogleConsumerKey, SecretApiKey = GoogleConsumerSecret });

            var authenticationProviderFactory = new AuthenticationProviderFactory();

            //authenticationProviderFactory.AddProvider(twitterProvider);
            authenticationProviderFactory.AddProvider(facebookProvider);
            authenticationProviderFactory.AddProvider(googleProvider);

            container.Register<IAuthenticationCallbackProvider>(new MedSetAuthenticationCallbackProvider());
        }
Ejemplo n.º 2
0
        public AuthenticationService(AuthenticationProviderFactory factory, ApplicationSettings appSettings)
        {
            _factory = factory;

            if (!String.IsNullOrWhiteSpace(appSettings.FacebookAppId) && !String.IsNullOrWhiteSpace(appSettings.FacebookAppSecret))
            {
                _factory.AddProvider(new FacebookProvider(new ProviderParams
                {
                    PublicApiKey = appSettings.FacebookAppId,
                    SecretApiKey = appSettings.FacebookAppSecret
                }));
            }
            else
            {
                _factory.RemoveProvider("facebook");
            }
            if (!String.IsNullOrWhiteSpace(appSettings.TwitterConsumerKey) && !String.IsNullOrWhiteSpace(appSettings.TwitterConsumerSecret))
            {
                _factory.AddProvider(new TwitterProvider(new ProviderParams
                {
                    PublicApiKey = appSettings.TwitterConsumerKey,
                    SecretApiKey = appSettings.TwitterConsumerSecret
                }));
            }
            else
            {
                _factory.RemoveProvider("twitter");
            }
            if (!String.IsNullOrWhiteSpace(appSettings.GoogleClientID) && !String.IsNullOrWhiteSpace(appSettings.GoogleClientSecret))
            {
                _factory.AddProvider(new GoogleProvider(new ProviderParams
                {
                    PublicApiKey = appSettings.GoogleClientID,
                    SecretApiKey = appSettings.GoogleClientSecret
                }));
            }
            else
            {
                _factory.RemoveProvider("google");
            }
        }
        protected override void ConfigureApplicationContainer(TinyIoCContainer container)
        {
            base.ConfigureApplicationContainer(container);

            // database configuration
            var factory = new RepositoryFactory();
            container.Register(factory.UserRepository);

            // security configuration
            var googleProvider = new GoogleProvider(new ProviderParams { PublicApiKey = GoogleClientId, SecretApiKey = GoogleSecret });
            var authenticationProviderFactory = new AuthenticationProviderFactory();
            authenticationProviderFactory.AddProvider(googleProvider);
            container.Register<IAuthenticationCallbackProvider>(new GoogleAuthenticationCallbackProvider(factory.UserRepository));

        }
Ejemplo n.º 4
0
        protected override void ConfigureApplicationContainer(TinyIoCContainer container)
        {
            base.ConfigureApplicationContainer(container);
            StaticConfiguration.DisableErrorTraces = false;

            FacebookProvider facebookProvider =
                new FacebookProvider(new ProviderParams
                {
                    PublicApiKey = FacebookCredentials.FacebookAppId,
                    SecretApiKey = FacebookCredentials.FacebookAppSecret
                });
            AuthenticationProviderFactory authenticationProviderFactory = new AuthenticationProviderFactory();
            authenticationProviderFactory.AddProvider(facebookProvider);

            container.Register<IAuthenticationCallbackProvider>(new SampleAuthenticationCallbackProvider());
        }
Ejemplo n.º 5
0
        protected override void ConfigureApplicationContainer(TinyIoCContainer container)
        {
            base.ConfigureApplicationContainer(container);

            var googleProvider = new GoogleProvider(new ProviderParams
            {
                PublicApiKey = GlobalConfig.GoogleConsumerKey,
                SecretApiKey = GlobalConfig.GoogleConsumerSecret
            });

            var authenticationProviderFactory = new AuthenticationProviderFactory();

            authenticationProviderFactory.AddProvider(googleProvider);

            container.Register<IAuthenticationCallbackProvider>(new RusserAuthenticationCallbackProvider());
        }
Ejemplo n.º 6
0
        // The bootstrapper enables you to reconfigure the composition of the framework,
        // by overriding the various methods and properties.
        // For more information https://github.com/NancyFx/Nancy/wiki/Bootstrapper
        protected override void ConfigureRequestContainer(Nancy.TinyIoc.TinyIoCContainer container, NancyContext context)
        {
            base.ConfigureRequestContainer(container, context);

            var githubAuth = new GitHubProvider(new ProviderParams() {
                PublicApiKey = Environment.GetEnvironmentVariable("PEASANT_OAUTH_ID") ?? "68e704a8ede918f8d940",
                SecretApiKey = Environment.GetEnvironmentVariable("PEASANT_OAUTH_KEY") ?? "888b305d22b2d7251b087c5903be21f7eaca4e20",
                Scopes = new[] { "repo", "user", "status", }
            });

            var authServiceFactory = new AuthenticationProviderFactory();
            authServiceFactory.AddProvider(githubAuth);

            container.Register<IAuthenticationCallbackProvider>(new AuthenticationCallbackProvider());

            BlobCache.ApplicationName = "Peasant";
        }