public function testLogout() { Zend_Session::$_unitTestEnabled = true; $this->_server->setAuth(new RightPassword("testuser", "testrole")); $this->_acl->addRole(new Zend_Acl_Role("testrole")); $this->_acl->allow("testrole", null, null); $this->_server->setAcl($this->_acl); $resp = $this->_callServiceAuth("testuser", ""); $this->assertTrue($resp[0]->getData() instanceof Zend_Amf_Value_Messaging_AcknowledgeMessage); $this->assertContains("hello", $resp[1]->getData()); // After logout same request should not be allowed $this->setUp(); $this->_server->setAuth(new RightPassword("testuser", "testrole")); $this->_server->setAcl($this->_acl); $request = new Zend_Amf_Request(); $request->setObjectEncoding(0x3); $this->_addLogout($request); $this->_addServiceCall($request); $this->_server->handle($request); $resp = $this->_server->getResponse()->getAmfBodies(); $this->assertTrue($resp[0]->getData() instanceof Zend_Amf_Value_Messaging_AcknowledgeMessage); $data = $resp[1]->getData(); $this->assertTrue($data instanceof Zend_Amf_Value_Messaging_ErrorMessage); $this->assertContains("not allowed", $data->faultString); }
public function testLogout() { $this->_server->setAuth(new TestAsset\Authentication\RightPassword("testuser", "testrole")); $this->_acl->addRole(new Role\GenericRole("testrole")); $this->_acl->allow("testrole", null, null); $this->_server->setAcl($this->_acl); $resp = $this->_callServiceAuth("testuser", ""); $this->assertTrue($resp[0]->getData() instanceof Messaging\AcknowledgeMessage); $this->assertContains("hello", $resp[1]->getData()); // After logout same request should not be allowed $this->setUp(); $this->_server->setAuth(new TestAsset\Authentication\RightPassword("testuser", "testrole")); $this->_server->setAcl($this->_acl); $request = new Request\StreamRequest(); $request->setObjectEncoding(0x03); $this->_addLogout($request); $this->_addServiceCall($request); $this->_server->handle($request); $resp = $this->_server->getResponse()->getAmfBodies(); $this->assertTrue($resp[0]->getData() instanceof Messaging\AcknowledgeMessage); $data = $resp[1]->getData(); $this->assertTrue($data instanceof Messaging\ErrorMessage); $this->assertContains("not allowed", $data->faultString); }
public function amfAction() { $server = new Zend_Amf_Server(); require_once APPLICATION_PATH . '/auth/Auth.php'; $server->setAuth(new Auth()); $server->addDirectory(APPLICATION_PATH . '/services/'); $response = $server->handle(); echo $response; }