当前位置: 首页>>代码示例>>PHP>>正文


PHP Mvc\ActionRequest类代码示例

本文整理汇总了PHP中TYPO3\Flow\Mvc\ActionRequest的典型用法代码示例。如果您正苦于以下问题:PHP ActionRequest类的具体用法?PHP ActionRequest怎么用?PHP ActionRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ActionRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 /**
  * @return void
  */
 public function setUp()
 {
     $this->viewHelperVariableContainer = $this->getMock('TYPO3\\Fluid\\Core\\ViewHelper\\ViewHelperVariableContainer');
     $this->viewHelperVariableContainer->expects($this->any())->method('exists')->will($this->returnCallback(array($this, 'viewHelperVariableContainerExistsCallback')));
     $this->viewHelperVariableContainer->expects($this->any())->method('get')->will($this->returnCallback(array($this, 'viewHelperVariableContainerGetCallback')));
     $this->templateVariableContainer = $this->getMock('TYPO3\\Fluid\\Core\\ViewHelper\\TemplateVariableContainer');
     $this->uriBuilder = $this->getMock('TYPO3\\Flow\\Mvc\\Routing\\UriBuilder');
     $this->uriBuilder->expects($this->any())->method('reset')->will($this->returnValue($this->uriBuilder));
     $this->uriBuilder->expects($this->any())->method('setArguments')->will($this->returnValue($this->uriBuilder));
     $this->uriBuilder->expects($this->any())->method('setSection')->will($this->returnValue($this->uriBuilder));
     $this->uriBuilder->expects($this->any())->method('setFormat')->will($this->returnValue($this->uriBuilder));
     $this->uriBuilder->expects($this->any())->method('setCreateAbsoluteUri')->will($this->returnValue($this->uriBuilder));
     $this->uriBuilder->expects($this->any())->method('setAddQueryString')->will($this->returnValue($this->uriBuilder));
     $this->uriBuilder->expects($this->any())->method('setArgumentsToBeExcludedFromQueryString')->will($this->returnValue($this->uriBuilder));
     // BACKPORTER TOKEN #1
     $httpRequest = \TYPO3\Flow\Http\Request::create(new \TYPO3\Flow\Http\Uri('http://localhost/foo'));
     $this->request = $this->getMock('TYPO3\\Flow\\Mvc\\ActionRequest', array(), array($httpRequest));
     $this->request->expects($this->any())->method('isMainRequest')->will($this->returnValue(TRUE));
     $this->controllerContext = $this->getMock('TYPO3\\Flow\\Mvc\\Controller\\ControllerContext', array(), array(), '', FALSE);
     $this->controllerContext->expects($this->any())->method('getUriBuilder')->will($this->returnValue($this->uriBuilder));
     $this->controllerContext->expects($this->any())->method('getRequest')->will($this->returnValue($this->request));
     $this->tagBuilder = $this->getMock('TYPO3\\Fluid\\Core\\ViewHelper\\TagBuilder');
     $this->arguments = array();
     $this->renderingContext = new \TYPO3\Fluid\Core\Rendering\RenderingContext();
     $this->renderingContext->injectTemplateVariableContainer($this->templateVariableContainer);
     $this->renderingContext->injectViewHelperVariableContainer($this->viewHelperVariableContainer);
     $this->renderingContext->setControllerContext($this->controllerContext);
 }
开发者ID:sengkimlong,项目名称:Flow3-Authentification,代码行数:31,代码来源:ViewHelperBaseTestcase.php

示例2: getResponse

 /**
  * Returns an Response object containing the OPAuth data
  *
  * @return Response
  */
 public function getResponse()
 {
     if ($this->actionRequest instanceof \TYPO3\Flow\Mvc\ActionRequest && $this->actionRequest->hasArgument('opauth')) {
         $data = $this->actionRequest->getArgument('opauth');
         $response = unserialize(base64_decode($data));
         $this->response = new Response($response);
     }
     return $this->response;
 }
开发者ID:sixty-nine,项目名称:Hfrahmann.Opauth,代码行数:14,代码来源:Opauth.php

示例3: createActionRequest

 /**
  * @param Request $httpRequest
  * @param array $matchResults
  * @return ActionRequest
  */
 protected function createActionRequest(Request $httpRequest, array $matchResults = NULL)
 {
     $actionRequest = new ActionRequest($httpRequest);
     if ($matchResults !== NULL) {
         $requestArguments = $actionRequest->getArguments();
         $mergedArguments = Arrays::arrayMergeRecursiveOverrule($requestArguments, $matchResults);
         $actionRequest->setArguments($mergedArguments);
     }
     return $actionRequest;
 }
开发者ID:sakona999,项目名称:flow-login,代码行数:15,代码来源:RoutingTest.php

示例4: updateCredentials

 /**
  * Updates the authentication credentials, the authentication manager needs to authenticate this token.
  * This could be a username/password from a login controller.
  * This method is called while initializing the security context. By returning TRUE you
  * make sure that the authentication manager will (re-)authenticate the tokens with the current credentials.
  * Note: You should not persist the credentials!
  *
  * @param \TYPO3\Flow\Mvc\ActionRequest $actionRequest The current request instance
  *
  * @return bool TRUE if this token needs to be (re-)authenticated
  */
 public function updateCredentials(\TYPO3\Flow\Mvc\ActionRequest $actionRequest)
 {
     $httpRequest = $actionRequest->getHttpRequest();
     if ($httpRequest->getMethod() !== 'GET') {
         return;
     }
     if ($actionRequest->getInternalArgument('__casAuthenticationProviderName') === $this->authenticationProviderName) {
         $this->authenticationStatus = self::AUTHENTICATION_NEEDED;
     }
 }
开发者ID:rafaelka,项目名称:jasigphpcas,代码行数:21,代码来源:PhpCasToken.php

示例5: actionRequestStripsParentHttpRequest

 /**
  * @test
  */
 public function actionRequestStripsParentHttpRequest()
 {
     $httpRequest = Request::create(new Uri('http://typo3.org'));
     $actionRequest = new ActionRequest($httpRequest);
     $actionRequest->setControllerActionName('foo');
     $serializedActionRequest = serialize($actionRequest);
     /* @var $unserializedActionRequest ActionRequest */
     $unserializedActionRequest = unserialize($serializedActionRequest);
     $this->assertNull($unserializedActionRequest->getParentRequest(), 'Parent HTTP request should be NULL after deserialization');
     $this->assertSame('foo', $unserializedActionRequest->getControllerActionName());
 }
开发者ID:nlx-sascha,项目名称:flow-development-collection,代码行数:14,代码来源:ActionRequestTest.php

示例6: updateCredentials

 /**
  * Updates the identifier credential from the GET/POST vars, if the GET/POST parameters
  * are available. Sets the authentication status to AUTHENTICATION_NEEDED, if credentials have been sent.
  *
  * Note: You need to send the password in this parameter:
  *       __authentication[_OurBrand_][Quiz][Security][IdentifierToken][identifier]
  *
  * @param \TYPO3\Flow\Mvc\ActionRequest $actionRequest The current action request
  * @return void
  */
 public function updateCredentials(\TYPO3\Flow\Mvc\ActionRequest $actionRequest)
 {
     $postArguments = $actionRequest->getInternalArguments();
     $username = \TYPO3\Flow\Reflection\ObjectAccess::getPropertyPath($postArguments, '__authentication._OurBrand_.Quiz.Security.IdentifierToken.username');
     $password = \TYPO3\Flow\Reflection\ObjectAccess::getPropertyPath($postArguments, '__authentication._OurBrand_.Quiz.Security.IdentifierToken.password');
     if (!empty($username) && !empty($password)) {
         $this->credentials['username'] = $username;
         $this->credentials['password'] = $password;
         $this->setAuthenticationStatus(self::AUTHENTICATION_NEEDED);
     }
 }
开发者ID:sdrech,项目名称:example_quiz,代码行数:21,代码来源:IdentifierToken.php

示例7: onAuthenticationSuccess

 /**
  * Is called if authentication was successful.
  *
  * See the implementation in the AbstractAuthenticationController for details!
  *
  * @param \TYPO3\Flow\Mvc\ActionRequest $originalRequest The request that was intercepted by the security framework, NULL if there was none
  * @return string
  */
 protected function onAuthenticationSuccess(\TYPO3\Flow\Mvc\ActionRequest $originalRequest = NULL)
 {
     // if the login attempt is authenticated, add a success flash message
     $this->addFlashMessage($this->translate('status_login_success', 'Login'));
     // basically redirect to the intercepted requiest if there's one - but never redirect
     // to the login form after successful login as this seems to make no sense.
     if ($originalRequest !== NULL && $originalRequest->getControllerActionName() != 'login') {
         $this->redirectToRequest($originalRequest);
     } else {
         $this->redirect('dashboard', 'Standard');
     }
 }
开发者ID:yashodhank,项目名称:panel,代码行数:20,代码来源:LoginController.php

示例8: updateCredentials

 /**
  * Updates the password credential from the POST vars, if the POST parameters
  * are available. Sets the authentication status to AUTHENTICATION_NEEDED, if credentials have been sent.
  *
  * Note: You need to send the password in this POST parameter:
  *       __authentication[TYPO3][Flow][Security][Authentication][Token][PasswordToken][password]
  *
  * @param \TYPO3\Flow\Mvc\ActionRequest $actionRequest The current action request
  * @return void
  */
 public function updateCredentials(\TYPO3\Flow\Mvc\ActionRequest $actionRequest)
 {
     if ($actionRequest->getHttpRequest()->getMethod() !== 'POST') {
         return;
     }
     $postArguments = $actionRequest->getInternalArguments();
     $password = \TYPO3\Flow\Reflection\ObjectAccess::getPropertyPath($postArguments, '__authentication.TYPO3.Flow.Security.Authentication.Token.PasswordToken.password');
     if (!empty($password)) {
         $this->credentials['password'] = $password;
         $this->setAuthenticationStatus(self::AUTHENTICATION_NEEDED);
     }
 }
开发者ID:nlx-sascha,项目名称:flow-development-collection,代码行数:22,代码来源:PasswordToken.php

示例9: updateCredentials

 /**
  * Updates the username and password credentials from the HTTP authorization header.
  * Sets the authentication status to AUTHENTICATION_NEEDED, if the header has been
  * sent, to NO_CREDENTIALS_GIVEN if no authorization header was there.
  *
  * @param \TYPO3\Flow\Mvc\ActionRequest $actionRequest The current action request instance
  * @return void
  */
 public function updateCredentials(\TYPO3\Flow\Mvc\ActionRequest $actionRequest)
 {
     $authorizationHeader = $actionRequest->getHttpRequest()->getHeaders()->get('Authorization');
     if (substr($authorizationHeader, 0, 5) === 'Basic') {
         $credentials = base64_decode(substr($authorizationHeader, 6));
         $this->credentials['username'] = substr($credentials, 0, strpos($credentials, ':'));
         $this->credentials['password'] = substr($credentials, strpos($credentials, ':') + 1);
         $this->setAuthenticationStatus(self::AUTHENTICATION_NEEDED);
     } else {
         $this->credentials = array('username' => null, 'password' => null);
         $this->authenticationStatus = self::NO_CREDENTIALS_GIVEN;
     }
 }
开发者ID:robertlemke,项目名称:flow-development-collection,代码行数:21,代码来源:UsernamePasswordHttpBasic.php

示例10: updateCredentials

 /**
  * Updates the username and password credentials from the POST vars, if the POST parameters
  * are available. Sets the authentication status to REAUTHENTICATION_NEEDED, if credentials have been sent.
  *
  * @param \TYPO3\Flow\Mvc\ActionRequest $actionRequest The current action request instance
  * @return void
  */
 public function updateCredentials(\TYPO3\Flow\Mvc\ActionRequest $actionRequest)
 {
     $getArguments = $actionRequest->getArguments();
     if (!empty($getArguments['user']) && !empty($getArguments['signature']) && !empty($getArguments['expires']) && !empty($getArguments['version']) && !empty($getArguments['tpa_id']) && !empty($getArguments['action']) && !empty($getArguments['flags']) && !empty($getArguments['userdata'])) {
         $this->credentials['username'] = $getArguments['user'];
         $this->credentials['signature'] = \TYPO3\Flow\Utility\TypeHandling::hex2bin($getArguments['signature']);
         $this->credentials['expires'] = $getArguments['expires'];
         $this->credentials['version'] = $getArguments['version'];
         $this->credentials['tpaId'] = $getArguments['tpa_id'];
         $this->credentials['action'] = $getArguments['action'];
         $this->credentials['flags'] = $getArguments['flags'];
         $this->credentials['userdata'] = $getArguments['userdata'];
         $this->setAuthenticationStatus(self::AUTHENTICATION_NEEDED);
     }
 }
开发者ID:nlx-sascha,项目名称:flow-development-collection,代码行数:22,代码来源:Typo3OrgSsoToken.php

示例11: updateCredentials

 /**
  * Updates the username and password credentials from the POST vars, if the POST parameters
  * are available. Sets the authentication status to REAUTHENTICATION_NEEDED, if credentials have been sent.
  *
  * Note: You need to send the username and password in these two POST parameters:
  *       __authentication[TYPO3][Flow][Security][Authentication][Token][UsernamePassword][username]
  *   and __authentication[TYPO3][Flow][Security][Authentication][Token][UsernamePassword][password]
  *
  * @param ActionRequest $actionRequest The current action request
  * @return void
  */
 public function updateCredentials(ActionRequest $actionRequest)
 {
     $httpRequest = $actionRequest->getHttpRequest();
     if ($httpRequest->getMethod() !== 'POST') {
         return;
     }
     $arguments = $actionRequest->getInternalArguments();
     $username = ObjectAccess::getPropertyPath($arguments, '__authentication.TYPO3.Flow.Security.Authentication.Token.UsernamePassword.username');
     $password = ObjectAccess::getPropertyPath($arguments, '__authentication.TYPO3.Flow.Security.Authentication.Token.UsernamePassword.password');
     if (!empty($username) && !empty($password)) {
         $this->credentials['username'] = $username;
         $this->credentials['password'] = $password;
         $this->setAuthenticationStatus(self::AUTHENTICATION_NEEDED);
     }
 }
开发者ID:mkeitsch,项目名称:flow-development-collection,代码行数:26,代码来源:UsernamePassword.php

示例12: buildPluginRequest

 /**
  * Build the proper pluginRequest to render the PluginView
  * of some configured Master Plugin
  *
  * @return ActionRequest
  */
 protected function buildPluginRequest()
 {
     /** @var $parentRequest ActionRequest */
     $parentRequest = $this->tsRuntime->getControllerContext()->getRequest();
     $pluginRequest = new ActionRequest($parentRequest);
     if (!$this->pluginViewNode instanceof NodeInterface) {
         $pluginRequest->setArgumentNamespace('--' . $this->getPluginNamespace());
         $this->passArgumentsToPluginRequest($pluginRequest);
         $pluginRequest->setControllerPackageKey($this->getPackage());
         $pluginRequest->setControllerSubpackageKey($this->getSubpackage());
         $pluginRequest->setControllerName($this->getController());
         $pluginRequest->setControllerActionName($this->getAction());
         return $pluginRequest;
     }
     $pluginNodeIdentifier = $this->pluginViewNode->getProperty('plugin');
     if (strlen($pluginNodeIdentifier) === 0) {
         return $pluginRequest;
     }
     // Set the node to render this to the master plugin node
     $this->node = $this->pluginViewNode->getContext()->getNodeByIdentifier($pluginNodeIdentifier);
     if ($this->node === null) {
         return $pluginRequest;
     }
     $pluginRequest->setArgument('__node', $this->node);
     $pluginRequest->setArgumentNamespace('--' . $this->getPluginNamespace());
     $this->passArgumentsToPluginRequest($pluginRequest);
     if ($pluginRequest->getControllerObjectName() !== '') {
         return $pluginRequest;
     }
     $controllerObjectPairs = array();
     $pluginViewName = $this->pluginViewNode->getProperty('view');
     foreach ($this->pluginService->getPluginViewDefinitionsByPluginNodeType($this->node->getNodeType()) as $pluginViewDefinition) {
         /** @var PluginViewDefinition $pluginViewDefinition */
         if ($pluginViewDefinition->getName() !== $pluginViewName) {
             continue;
         }
         $controllerObjectPairs = $pluginViewDefinition->getControllerActionPairs();
         break;
     }
     if ($controllerObjectPairs === array()) {
         return $pluginRequest;
     }
     $defaultControllerObjectName = key($controllerObjectPairs);
     $defaultActionName = current($controllerObjectPairs[$defaultControllerObjectName]);
     $pluginRequest->setControllerObjectName($defaultControllerObjectName);
     $pluginRequest->setControllerActionName($defaultActionName);
     return $pluginRequest;
 }
开发者ID:mgoldbeck,项目名称:neos-development-collection,代码行数:54,代码来源:PluginViewImplementation.php

示例13: updateCredentialsIgnoresAnythingOtherThanPostRequests

 /**
  * @test
  */
 public function updateCredentialsIgnoresAnythingOtherThanPostRequests()
 {
     $arguments = array();
     $arguments['__authentication']['TYPO3']['Flow']['Security']['Authentication']['Token']['PasswordToken']['password'] = 'verysecurepassword';
     $this->mockHttpRequest->expects($this->atLeastOnce())->method('getMethod')->will($this->returnValue('POST'));
     $this->mockActionRequest->expects($this->atLeastOnce())->method('getInternalArguments')->will($this->returnValue($arguments));
     $this->token->updateCredentials($this->mockActionRequest);
     $this->assertEquals(array('password' => 'verysecurepassword'), $this->token->getCredentials());
     $secondToken = new PasswordToken();
     $secondMockActionRequest = $this->getMockBuilder(\TYPO3\Flow\Mvc\ActionRequest::class)->disableOriginalConstructor()->getMock();
     $secondMockHttpRequest = $this->getMockBuilder(\TYPO3\Flow\Http\Request::class)->disableOriginalConstructor()->getMock();
     $secondMockActionRequest->expects($this->any())->method('getHttpRequest')->will($this->returnValue($secondMockHttpRequest));
     $secondMockHttpRequest->expects($this->atLeastOnce())->method('getMethod')->will($this->returnValue('GET'));
     $secondToken->updateCredentials($secondMockActionRequest);
     $this->assertEquals(array('password' => ''), $secondToken->getCredentials());
 }
开发者ID:nlx-sascha,项目名称:flow-development-collection,代码行数:19,代码来源:PasswordTokenTest.php

示例14: dispatchContinuesWithNextRequestFoundInAForwardException

 /**
  * @test
  */
 public function dispatchContinuesWithNextRequestFoundInAForwardException()
 {
     $httpRequest = Request::create(new Uri('http://localhost'));
     $httpResponse = new Response();
     $mainRequest = $httpRequest->createActionRequest();
     $subRequest = new ActionRequest($mainRequest);
     $nextRequest = $httpRequest->createActionRequest();
     $mainRequest->setDispatched(TRUE);
     $mainRequest->setControllerSubPackageKey('main');
     $subRequest->setControllerSubPackageKey('sub');
     $nextRequest->setControllerSubPackageKey('next');
     $mockController = $this->getMock('TYPO3\\Flow\\Mvc\\Controller\\ControllerInterface', array('processRequest'));
     $mockController->expects($this->at(0))->method('processRequest')->will($this->returnCallback(function (ActionRequest $request) use($nextRequest) {
         $request->setDispatched(TRUE);
         $forwardException = new ForwardException();
         $forwardException->setNextRequest($nextRequest);
         throw $forwardException;
     }));
     $mockController->expects($this->at(1))->method('processRequest')->will($this->returnCallback(function (ActionRequest $request) use($nextRequest) {
         // NOTE: PhpUnit creates a clone of $nextRequest, thus $request is not the same instance as expected.
         if ($request == $nextRequest) {
             $nextRequest->setDispatched(TRUE);
         }
     }));
     $dispatcher = $this->getMock('TYPO3\\Flow\\Mvc\\Dispatcher', array('resolveController', 'emitAfterControllerInvocation'), array(), '', FALSE);
     $dispatcher->expects($this->any())->method('resolveController')->will($this->returnValue($mockController));
     $dispatcher->dispatch($subRequest, $httpResponse);
 }
开发者ID:animaltool,项目名称:webinterface,代码行数:31,代码来源:DispatcherTest.php

示例15: handleMergesInternalArgumentsWithRoutingMatchResults

 /**
  * @test
  */
 public function handleMergesInternalArgumentsWithRoutingMatchResults()
 {
     $this->mockHttpRequest->expects($this->any())->method('getArguments')->will($this->returnValue(array('__internalArgument1' => 'request', '__internalArgument2' => 'request', '__internalArgument3' => 'request')));
     $this->mockPropertyMapper->expects($this->any())->method('convert')->with('', 'array', $this->mockPropertyMappingConfiguration)->will($this->returnValue(array('__internalArgument2' => 'requestBody', '__internalArgument3' => 'requestBody')));
     $this->mockComponentContext->expects($this->atLeastOnce())->method('getParameter')->with('TYPO3\\Flow\\Mvc\\Routing\\RoutingComponent', 'matchResults')->will($this->returnValue(array('__internalArgument3' => 'routing')));
     $this->mockActionRequest->expects($this->once())->method('setArguments')->with(array('__internalArgument1' => 'request', '__internalArgument2' => 'requestBody', '__internalArgument3' => 'routing'));
     $this->dispatchComponent->handle($this->mockComponentContext);
 }
开发者ID:sokunthearith,项目名称:Intern-Project-Week-2,代码行数:11,代码来源:DispatchComponentTest.php


注:本文中的TYPO3\Flow\Mvc\ActionRequest类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。