From 65345116cdb2f938a9edb3dfbfc3a529394f44a0 Mon Sep 17 00:00:00 2001 From: Jeffery Fernandez Date: Sat, 1 Mar 2014 15:34:43 +1100 Subject: [PATCH 1/2] Adding config to allow Facebook auth to trust forwarded sessions This change relies on hybridauth pull request https://github.com/hybridauth/hybridauth/pull/159 Problem is described here: https://github.com/hybridauth/hybridauth/issues/155 --- config/scn-social-auth.global.php.dist | 9 +++++++ src/ScnSocialAuth/Options/ModuleOptions.php | 25 +++++++++++++++++++ .../Service/HybridAuthFactory.php | 1 + 3 files changed, 35 insertions(+) diff --git a/config/scn-social-auth.global.php.dist b/config/scn-social-auth.global.php.dist index 2166c462..b16b1748 100644 --- a/config/scn-social-auth.global.php.dist +++ b/config/scn-social-auth.global.php.dist @@ -60,6 +60,15 @@ $settings = array( */ //'facebook_display' => '', + /** + * Facebook Trust forwarded sessions + * Improves session security on shared domains + * + * @see https://github.com/facebook/facebook-php-sdk/commit/42481fa03f98465fd6dc6eb99a5124c01e8797d2 + * + */ + //'facebook_trust_forwarded' => false, + /** * Foursquare Enabled * diff --git a/src/ScnSocialAuth/Options/ModuleOptions.php b/src/ScnSocialAuth/Options/ModuleOptions.php index 9668c7c3..6417b302 100644 --- a/src/ScnSocialAuth/Options/ModuleOptions.php +++ b/src/ScnSocialAuth/Options/ModuleOptions.php @@ -57,6 +57,11 @@ class ModuleOptions extends AbstractOptions */ protected $facebookDisplay; + /** + * @var boolean + */ + protected $facebookTrustForwarded; + /** * @var string */ @@ -417,6 +422,26 @@ public function getFacebookDisplay() return $this->facebookDisplay; } + /** + * @param boolean $facebookTrustForwarded + * + * @return ModuleOptions + */ + public function setFacebookTrustForwarded( $facebookTrustForwarded ) + { + $this->facebookTrustForwarded = $facebookTrustForwarded; + + return $this; + } + + /** + * @return boolean + */ + public function getFacebookTrustForwarded() + { + return $this->facebookTrustForwarded; + } + /** * set foursquare enabled * diff --git a/src/ScnSocialAuth/Service/HybridAuthFactory.php b/src/ScnSocialAuth/Service/HybridAuthFactory.php index a004e077..013e0fdd 100644 --- a/src/ScnSocialAuth/Service/HybridAuthFactory.php +++ b/src/ScnSocialAuth/Service/HybridAuthFactory.php @@ -43,6 +43,7 @@ public function createService(ServiceLocatorInterface $services) ), 'scope' => $options->getFacebookScope(), 'display' => $options->getFacebookDisplay(), + 'trustForwarded' => $options->getFacebookTrustForwarded(), ), 'Foursquare' => array( 'enabled' => $options->getFoursquareEnabled(), From 35fb162adb018b5d7ae312cac2c23645ec8ed151 Mon Sep 17 00:00:00 2001 From: Jeffery Fernandez Date: Sat, 1 Mar 2014 19:14:38 +1100 Subject: [PATCH 2/2] Fixed coding style --- src/ScnSocialAuth/Options/ModuleOptions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ScnSocialAuth/Options/ModuleOptions.php b/src/ScnSocialAuth/Options/ModuleOptions.php index 6417b302..1ede4c5f 100644 --- a/src/ScnSocialAuth/Options/ModuleOptions.php +++ b/src/ScnSocialAuth/Options/ModuleOptions.php @@ -427,7 +427,7 @@ public function getFacebookDisplay() * * @return ModuleOptions */ - public function setFacebookTrustForwarded( $facebookTrustForwarded ) + public function setFacebookTrustForwarded($facebookTrustForwarded) { $this->facebookTrustForwarded = $facebookTrustForwarded;