Exemple #1
0
        public ActionResult Configure(TwitterExternalAuthSettings settings)
        {
            if (!Services.Permissions.Authorize(StandardPermissionProvider.ManageExternalAuthenticationMethods))
            {
                return(AccessDeniedPartialView());
            }

            var model = new ConfigurationModel();

            model.ConsumerKey    = settings.ConsumerKey;
            model.ConsumerSecret = settings.ConsumerSecret;
            model.CallbackUrls   = new List <string>();

            var store         = Services.StoreContext.CurrentStore;
            var storeLocation = Services.WebHelper.GetStoreLocation(false);

            model.CallbackUrls.Add(Services.WebHelper.GetStoreLocation(false) + "Plugins/SmartStore.TwitterAuth/LoginCallback/");

            if (store.SslEnabled)
            {
                model.CallbackUrls.Add(Services.WebHelper.GetStoreLocation(true) + "Plugins/SmartStore.TwitterAuth/LoginCallback/");
            }
            else
            {
                model.CallbackUrls.Add(Services.WebHelper.GetStoreLocation(false).EnsureEndsWith("/"));
            }

            return(View(model));
        }
 public TwitterProviderAuthorizer(IExternalAuthorizer authorizer,
                                  IOpenAuthenticationService openAuthenticationService,
                                  TwitterExternalAuthSettings twitterExternalAuthSettings,
                                  HttpContextBase httpContext)
 {
     this._authorizer = authorizer;
     this._openAuthenticationService   = openAuthenticationService;
     this._twitterExternalAuthSettings = twitterExternalAuthSettings;
     this._httpContext = httpContext;
 }
 public TwitterProviderAuthorizer(IExternalAuthorizer authorizer,
     IOpenAuthenticationService openAuthenticationService,
     TwitterExternalAuthSettings twitterExternalAuthSettings,
     HttpContextBase httpContext)
 {
     this._authorizer = authorizer;
     this._openAuthenticationService = openAuthenticationService;
     this._twitterExternalAuthSettings = twitterExternalAuthSettings;
     this._httpContext = httpContext;
 }
 public ExternalAuthTwitterController(ISettingService settingService,
                                      TwitterExternalAuthSettings twitterExternalAuthSettings,
                                      IOAuthProviderTwitterAuthorizer oAuthProviderTwitterAuthorizer,
                                      IOpenAuthenticationService openAuthenticationService,
                                      ExternalAuthenticationSettings externalAuthenticationSettings)
 {
     this._settingService = settingService;
     this._twitterExternalAuthSettings    = twitterExternalAuthSettings;
     this._oAuthProviderTwitterAuthorizer = oAuthProviderTwitterAuthorizer;
     this._openAuthenticationService      = openAuthenticationService;
     this._externalAuthenticationSettings = externalAuthenticationSettings;
 }
 public ExternalAuthTwitterController(ISettingService settingService,
     TwitterExternalAuthSettings twitterExternalAuthSettings,
     IOAuthProviderTwitterAuthorizer oAuthProviderTwitterAuthorizer,
     IOpenAuthenticationService openAuthenticationService,
     ExternalAuthenticationSettings externalAuthenticationSettings)
 {
     this._settingService = settingService;
     this._twitterExternalAuthSettings = twitterExternalAuthSettings;
     this._oAuthProviderTwitterAuthorizer = oAuthProviderTwitterAuthorizer;
     this._openAuthenticationService = openAuthenticationService;
     this._externalAuthenticationSettings = externalAuthenticationSettings;
 }
        public TwitterProviderAuthorizer(
            IExternalAuthorizer authorizer,
            HttpContextBase httpContext,
            ICommonServices services,
            TwitterExternalAuthSettings twitterSettings)
        {
            _authorizer      = authorizer;
            _httpContext     = httpContext;
            _services        = services;
            _twitterSettings = twitterSettings;

            Logger = NullLogger.Instance;
        }
        public ActionResult Configure(ConfigurationModel model, TwitterExternalAuthSettings settings)
        {
            if (!ModelState.IsValid)
            {
                return(Configure(settings));
            }

            settings.ConsumerKey    = model.ConsumerKey.TrimSafe();
            settings.ConsumerSecret = model.ConsumerSecret.TrimSafe();

            NotifySuccess(T("Admin.Common.DataSuccessfullySaved"));

            return(RedirectToConfiguration(TwitterExternalAuthMethod.SystemName));
        }
        public ActionResult Configure(TwitterExternalAuthSettings settings)
        {
            if (!HasPermission(false))
            {
                return(AccessDeniedPartialView());
            }

            var model = new ConfigurationModel();

            model.ConsumerKey    = settings.ConsumerKey;
            model.ConsumerSecret = settings.ConsumerSecret;

            return(View(model));
        }
Exemple #9
0
        public ActionResult Configure(ConfigurationModel model, TwitterExternalAuthSettings settings)
        {
            if (!Services.Permissions.Authorize(StandardPermissionProvider.ManageExternalAuthenticationMethods))
            {
                return(Configure(settings));
            }

            if (!ModelState.IsValid)
            {
                return(Configure(settings));
            }

            settings.ConsumerKey    = model.ConsumerKey.TrimSafe();
            settings.ConsumerSecret = model.ConsumerSecret.TrimSafe();

            NotifySuccess(T("Admin.Common.DataSuccessfullySaved"));

            return(RedirectToConfiguration(TwitterExternalAuthMethod.SystemName));
        }
        public ActionResult Configure(ConfigurationModel model, TwitterExternalAuthSettings settings)
        {
            if (!HasPermission(false))
            {
                return(Configure(settings));
            }

            if (!ModelState.IsValid)
            {
                return(Configure(settings));
            }

            settings.ConsumerKey    = model.ConsumerKey.TrimSafe();
            settings.ConsumerSecret = model.ConsumerSecret.TrimSafe();

            NotifySuccess(T("Admin.Common.DataSuccessfullySaved"));

            return(RedirectToConfiguration("SmartStore.TwitterAuth"));
        }
        public ActionResult Configure(TwitterExternalAuthSettings settings)
        {
            var model = new ConfigurationModel();

            model.ConsumerKey    = settings.ConsumerKey;
            model.ConsumerSecret = settings.ConsumerSecret;
            model.CallbackUrls   = new List <string>();

            var store         = Services.StoreContext.CurrentStore;
            var storeLocation = Services.WebHelper.GetStoreLocation(false);

            model.CallbackUrls.Add(Services.WebHelper.GetStoreLocation(false) + "Plugins/SmartStore.TwitterAuth/LoginCallback/");

            if (store.SslEnabled)
            {
                model.CallbackUrls.Add(Services.WebHelper.GetStoreLocation(true) + "Plugins/SmartStore.TwitterAuth/LoginCallback/");
            }
            else
            {
                model.CallbackUrls.Add(Services.WebHelper.GetStoreLocation(false).EnsureEndsWith("/"));
            }

            return(View(model));
        }