public function testLogout()
 {
     $this->setSuccess();
     $this->setUserAuthInfo();
     IdCardAuthentication::login();
     IdCardAuthentication::logout();
     $this->assertFalse(isset($_SESSION[IdCardAuthentication::ID_CARD_USER_AUTH_SESSION_KEY]));
 }
Example #2
0
 public function testStartSession()
 {
     $this->setSuccess();
     $this->setUserAuthInfo();
     IdCardAuthentication::login();
     $service = new SignatureService();
     $service->setWsdl();
     $service->initSoap();
     $this->assertTrue(is_int($service->startSession($this->testFileName)));
     $this->assertEquals('https://www.openxades.org:9443/?wsdl', $service->getWsdl());
 }
Example #3
0
 public function testSigningProcess()
 {
     if ($this->getConfig()['signature']['hex'] === null) {
         $this->markTestSkipped('Test skipped, because no config was found.');
     }
     // login
     $this->setSuccess();
     $this->setUserAuthInfo();
     IdCardAuthentication::login();
     // start session
     $service = new SignatureService();
     $service->setWsdl();
     $service->initSoap();
     $sessionCode = $service->startSession($this->testFileName);
     // prepare
     $certificateConfig = $this->getConfig()['certificate'];
     $info = $service->prepareSignature($sessionCode, $certificateConfig['id'], $certificateConfig['hex']);
     //finalize
     $info2 = $service->finalizeSignature($sessionCode, $info['SignatureId'], $this->getConfig()['signature']['hex']);
 }
Example #4
0
 public function startDdockSession($documentPath, $storePath)
 {
     if (!IdCardAuthentication::isUserLoggedIn()) {
         IdCardAuthentication::login();
     }
     try {
         $contents = file_get_contents($documentPath);
         $contents = $this->prepareDdocDataFile($contents, $storePath);
         $result = $this->soap->startSession("", $contents, true)['Sesscode'];
         if (is_int($result)) {
             return $result;
         } else {
             throw new SigningException($result['Status']);
         }
     } catch (\SoapFault $e) {
         $this->catchSoapError($e);
     }
 }