public function validateResponseSignature(\GSResponse $response)
 {
     if ($response->getErrorCode() != 0 || $this->responseHasSignature($response)) {
         return new \Exception('Invalid response');
     }
     $uid = $response->getString('UID', '');
     $timestamp = $response->getString('signatureTimestamp', '');
     $uidSignature = $response->getString('UIDSignature', '');
     return \SigUtils::validateUserSignature($uid, $timestamp, $this->secretKey, $uidSignature);
 }
 protected function createAuthenticatedToken($gigyaUserId, \GSResponse $accountInfoResponse)
 {
     if (null === $this->userProvider) {
         return new GigyaUserToken($this->providerKey, $gigyaUserId, array());
     }
     $user = $this->userProvider->loadUserByGigyaUserId($gigyaUserId);
     if ($user == null) {
         $user = $this->userProvider->createUserWithGigyaAccount($gigyaUserId, $accountInfoResponse->getData());
     } else {
         $this->userProvider->updateUserWithGigyaAccount($user, $accountInfoResponse->getData());
     }
     if ($user instanceof UserInterface) {
         $this->userChecker->checkPreAuth($user);
         $this->userChecker->checkPostAuth($user);
     } else {
         throw new AuthenticationServiceException('The user provider must return a UserInterface object.');
     }
     return new GigyaUserToken($this->providerKey, $user, $user->getRoles());
 }
Exemple #3
0
 public static function Init()
 {
     self::$errorMsgDic = new GSObject();
     self::$errorMsgDic->put(400002, "Required parameter is missing");
     self::$errorMsgDic->put(500000, "General server error");
 }
 public static function Init()
 {
     self::$errorMsgDic = new GSObject();
     self::$errorMsgDic->put(400002, "Required parameter is missing");
     self::$errorMsgDic->put(400003, "You must set a certificate for HTTPS requests");
     self::$errorMsgDic->put(500000, "General server error");
 }