/** * company public key control processes has been wrapped * @param type $params * @return type * @author Mustafa Zeynel Dağlı * @since 0.4 09/06/2016 */ private function publicCompanyKeyProcessControler($params) { $resultSet; if ($this->isServiceCpkRequired) { /** * getting private key due to public key * @author Mustafa Zeynel Dağlı * @since 05/01/2016 version 0.3 */ if (isset($params['cpk']) && isset($params['pk'])) { $resultSet = $this->dalObject->isUserBelongToCompany($params['pk'], $params['cpk']); } /** * if user id and company key does not match * forward to user not belong to company * @author Mustafa Zeynel Dağlı * @since 06/01/2016 version 0.3 */ if (empty($resultSet['resultSet'])) { $this->userNotBelongCompany(); } return $resultSet; } else { return null; } }
/** * public key control processes has been wrapped * @param array $params * @return mixed array | null * @throws Exception * @author Mustafa Zeynel Dağlı * @since 0.3 27/01/2016 */ private function publicKeyProcessControler($params) { $resultSet; if ($this->isServicePkRequired) { /** * getting private key due to public key * @author Mustafa Zeynel Dağlı * @since 05/01/2016 version 0.3 */ if (isset($params['pk'])) { $resultSet = $this->dalObject->getPrivateKey($params['pk']); } /** * if not get private key due to public key * forward to private not found * @author Mustafa Zeynel Dağlı * @since 06/01/2016 version 0.3 */ if (empty($resultSet['resultSet'])) { $this->privateKeyNotFoundRedirect(); } /** * if service has to be secure then prepare hash for public and private keys * @author Mustafa Zeynel Dağlı * @since version 0.3 06/01/2016 */ if (!isset($resultSet['resultSet'][0]['sf_private_key_value'])) { throw new Exception('SlimHmacProxy->restApiDefaultCall() method private key not found!!'); } if (!isset($params['pk'])) { throw new Exception('SlimHmacProxy->restApiDefaultCall() method public key not found!!'); } else { $this->hmacObj->setPublicKey($params['pk']); } //$this->hmacObj->setPrivateKey('e249c439ed7697df2a4b045d97d4b9b7e1854c3ff8dd668c779013653913572e'); $this->hmacObj->setPrivateKey($resultSet['resultSet'][0]['sf_private_key_value']); $this->hmacObj->setRequestParams($this->getRequestParamsWithoutPublicKey()); $this->hmacObj->makeHmac(); //print_r($this->hmacObj); return $resultSet; } else { return null; } }