Exemple #1
0
 public AccountController(FacebookOAuthService facebookOAuthService, AuthenticationService authenticationService)
 {
     _facebookOAuthService  = facebookOAuthService;
     _authenticationService = authenticationService;
 }
        /// <summary>
        /// Enable facebook authentication for the application
        /// </summary>
        /// <param name="configuration">
        /// The facebook authentication configuration
        /// </param>
        /// <param name="facebookAPIFactory">
        /// The facebook object builder
        /// </param>
        /// <param name="facebookUrlHelper">
        /// The facebook url helper
        /// </param>
        public static void Enable(FacebookAuthenticationConfiguration configuration, IFacebookAPIFactory facebookAPIFactory, IFacebookUrlHelper facebookUrlHelper)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            if (!configuration.IsValid)
            {
                throw new ArgumentException("Configuration is invalid", "configuration");
            }

            if (facebookAPIFactory == null)
            {
                throw new ArgumentNullException("facebookAPIFactory");
            }

            if (facebookUrlHelper == null)
            {
                throw new ArgumentNullException("facebookUrlHelper");
            }

            Enabled = true;
            Configuration = configuration;
            FacebookClientService = new FacebookClientService(ApplicationAuthenticator, FacebookCurrentAuthenticatedUserCache, facebookAPIFactory);
            FacebookOAuthService = new FacebookOAuthService(facebookAPIFactory, facebookUrlHelper);
        }