/**
  * Perform security check
  *
  * @param int $requestType
  * @param string|null $accountReference
  * @param int|null $longIp
  * @return $this
  * @throws SecurityViolationException
  */
 public function performSecurityCheck($requestType, $accountReference = null, $longIp = null)
 {
     if (null === $longIp) {
         $longIp = $this->securityConfig->getRemoteIp();
     }
     foreach ($this->securityCheckers as $checker) {
         $checker->check($requestType, $accountReference, $longIp);
     }
     $this->createNewPasswordResetRequestEventRecord($requestType, $accountReference, $longIp);
     return $this;
 }
 /**
  * Create new record
  *
  * @return $this
  */
 protected function createNewSession()
 {
     $this->adminSessionInfoFactory->create()->setData(['session_id' => $this->authSession->getSessionId(), 'user_id' => $this->authSession->getUser()->getId(), 'ip' => $this->securityConfig->getRemoteIp(), 'status' => AdminSessionInfo::LOGGED_IN])->save();
     return $this;
 }
Пример #3
0
 /**
  * @return string
  */
 public function getRemoteIp()
 {
     return $this->securityConfig->getRemoteIp(false);
 }
 /**
  * @param bool $ipToLong
  * @dataProvider dataProviderBoolValues
  */
 public function testGetRemoteIp($ipToLong)
 {
     $this->remoteAddressMock->expects($this->once())->method('getRemoteAddress')->will($this->returnValue($ipToLong));
     $this->assertEquals($ipToLong, $this->helper->getRemoteIp($ipToLong));
 }