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


PHP ActionRequest::getHttpRequest方法代码示例

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


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

示例1: resolveActionMethodName

 /**
  * Determines the action method and assures that the method exists.
  *
  * @return string The action method name
  * @throws \TYPO3\Flow\Mvc\Exception\NoSuchActionException if the action specified in the request object does not exist (and if there's no default action either).
  */
 protected function resolveActionMethodName()
 {
     if ($this->request->getControllerActionName() === 'index') {
         $actionName = 'index';
         switch ($this->request->getHttpRequest()->getMethod()) {
             case 'HEAD':
             case 'GET':
                 $actionName = $this->request->hasArgument($this->resourceArgumentName) ? 'show' : 'list';
                 break;
             case 'POST':
                 $actionName = 'create';
                 break;
             case 'PUT':
                 if (!$this->request->hasArgument($this->resourceArgumentName)) {
                     $this->throwStatus(400, NULL, 'No resource specified');
                 }
                 $actionName = 'update';
                 break;
             case 'DELETE':
                 if (!$this->request->hasArgument($this->resourceArgumentName)) {
                     $this->throwStatus(400, NULL, 'No resource specified');
                 }
                 $actionName = 'delete';
                 break;
         }
         $this->request->setControllerActionName($actionName);
     }
     return parent::resolveActionMethodName();
 }
开发者ID:nlx-sascha,项目名称:flow-development-collection,代码行数:35,代码来源:RestController.php

示例2: getHttpRequestReturnsTheHttpRequestWhichIsTheRootOfAllActionRequests

 /**
  * @test
  */
 public function getHttpRequestReturnsTheHttpRequestWhichIsTheRootOfAllActionRequests()
 {
     $anotherActionRequest = new ActionRequest($this->actionRequest);
     $yetAnotherActionRequest = new ActionRequest($anotherActionRequest);
     $this->assertSame($this->mockHttpRequest, $this->actionRequest->getHttpRequest());
     $this->assertSame($this->mockHttpRequest, $yetAnotherActionRequest->getHttpRequest());
     $this->assertSame($this->mockHttpRequest, $anotherActionRequest->getHttpRequest());
 }
开发者ID:kszyma,项目名称:flow-development-collection,代码行数:11,代码来源:ActionRequestTest.php

示例3: 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

示例4: getHttpRequestReturnsTheHttpRequestWhichIsTheRootOfAllActionRequests

 /**
  * @test
  */
 public function getHttpRequestReturnsTheHttpRequestWhichIsTheRootOfAllActionRequests()
 {
     $httpRequest = HttpRequest::create(new Uri('http://robertlemke.com/blog'));
     $actionRequest = new ActionRequest($httpRequest);
     $anotherActionRequest = new ActionRequest($actionRequest);
     $yetAnotherActionRequest = new ActionRequest($anotherActionRequest);
     $this->assertSame($httpRequest, $actionRequest->getHttpRequest());
     $this->assertSame($httpRequest, $yetAnotherActionRequest->getHttpRequest());
     $this->assertSame($httpRequest, $anotherActionRequest->getHttpRequest());
 }
开发者ID:animaltool,项目名称:webinterface,代码行数:13,代码来源:ActionRequestTest.php

示例5: 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

示例6: 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 $request The current request instance
  * @return boolean 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;
     }
     // Check if we have a callback request
     $arguments = $httpRequest->getArguments();
     $accessTokenCipher = \TYPO3\Flow\Reflection\ObjectAccess::getPropertyPath($arguments, '__flowpack.singlesignon.accessToken');
     $signature = \TYPO3\Flow\Reflection\ObjectAccess::getPropertyPath($arguments, '__flowpack.singlesignon.signature');
     if (!empty($accessTokenCipher) && !empty($signature)) {
         // Get callback parameters from request
         $this->credentials['accessToken'] = base64_decode($accessTokenCipher);
         $this->credentials['signature'] = base64_decode($signature);
         $this->callbackUri = $actionRequest->getHttpRequest()->getUri();
         $arguments = $this->callbackUri->getArguments();
         unset($arguments['__flowpack']);
         $this->callbackUri->setQuery(http_build_query($arguments));
         $this->setAuthenticationStatus(self::AUTHENTICATION_NEEDED);
     }
 }
开发者ID:anihy,项目名称:Flowpack.SingleSignOn.Client,代码行数:31,代码来源:SingleSignOnToken.php

示例7: 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

示例8: updateCredentials

 /**
  * @param ActionRequest $actionRequest The current action request
  * @return void
  */
 public function updateCredentials(ActionRequest $actionRequest)
 {
     if ($actionRequest->getHttpRequest()->getMethod() === 'OPTIONS') {
         return;
     }
     $authorizationHeader = $actionRequest->getHttpRequest()->getHeaders()->get('Authorization');
     $authorizationArguments = $actionRequest->getArguments();
     if (isset($authorizationArguments['username']) && isset($authorizationArguments['password'])) {
         $this->credentials['username'] = $authorizationArguments['username'];
         $this->credentials['password'] = $authorizationArguments['password'];
         $this->setAuthenticationStatus(self::AUTHENTICATION_NEEDED);
         return;
     } elseif (substr($authorizationHeader, 0, 6) === 'Bearer') {
         $this->credentials['token'] = substr($authorizationHeader, 7);
         $this->credentials['user_agent'] = $actionRequest->getHttpRequest()->getHeader('User-Agent');
         $this->credentials['ip_address'] = $actionRequest->getHttpRequest()->getClientIpAddress();
         $this->setAuthenticationStatus(self::AUTHENTICATION_NEEDED);
         return;
     } else {
         $this->credentials = array('token' => NULL);
         $this->authenticationStatus = self::NO_CREDENTIALS_GIVEN;
         return;
     }
 }
开发者ID:rfyio,项目名称:JWT,代码行数:28,代码来源:JwtToken.php

示例9: 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

示例10: build

 /**
  * Builds the URI
  *
  * @param array $arguments optional URI arguments. Will be merged with $this->arguments with precedence to $arguments
  * @return string The URI
  * @api
  */
 public function build(array $arguments = array())
 {
     $arguments = Arrays::arrayMergeRecursiveOverrule($this->arguments, $arguments);
     $arguments = $this->mergeArgumentsWithRequestArguments($arguments);
     $uri = $this->router->resolve($arguments);
     $this->lastArguments = $arguments;
     if (!$this->environment->isRewriteEnabled()) {
         $uri = 'index.php/' . $uri;
     }
     $httpRequest = $this->request->getHttpRequest();
     if ($this->createAbsoluteUri === true) {
         $uri = $httpRequest->getBaseUri() . $uri;
     } elseif (!$this->createRelativePaths) {
         $uri = $httpRequest->getScriptRequestPath() . $uri;
     }
     if ($this->section !== '') {
         $uri .= '#' . $this->section;
     }
     return $uri;
 }
开发者ID:kszyma,项目名称:flow-development-collection,代码行数:27,代码来源:UriBuilder.php

示例11: 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 ActionRequest $actionRequest The current request instance
  * @throws \InvalidArgumentException
  * @return boolean TRUE if this token needs to be (re-)authenticated
  */
 public function updateCredentials(ActionRequest $actionRequest)
 {
     if ($actionRequest->getHttpRequest()->getMethod() !== 'GET' || $actionRequest->getInternalArgument('__oauth2Provider') !== $this->authenticationProviderName) {
         return;
     }
     if (!$actionRequest->hasArgument('code')) {
         $this->setAuthenticationStatus(TokenInterface::WRONG_CREDENTIALS);
         $this->securityLogger->log('There was no argument `code` provided.', LOG_NOTICE);
         return;
     }
     $code = $actionRequest->getArgument('code');
     $redirectUri = $this->oauthUriBuilder->getRedirectionEndpointUri($this->authenticationProviderName);
     try {
         $this->credentials['accessToken'] = $this->tokenEndpoint->requestAuthorizationCodeGrantAccessToken($code, $redirectUri);
         $this->setAuthenticationStatus(TokenInterface::AUTHENTICATION_NEEDED);
     } catch (Exception $exception) {
         $this->setAuthenticationStatus(TokenInterface::WRONG_CREDENTIALS);
         $this->securityLogger->logException($exception);
         return;
     }
 }
开发者ID:avency,项目名称:Flowpack.OAuth2.Client,代码行数:32,代码来源:AbstractClientToken.php

示例12: getHttpRequest

 /**
  * Returns the top level request: the HTTP request object
  *
  * @return HttpRequest
  * @api
  */
 public function getHttpRequest()
 {
     if ($this->rootRequest === null) {
         $this->rootRequest = $this->parentRequest instanceof HttpRequest ? $this->parentRequest : $this->parentRequest->getHttpRequest();
     }
     return $this->rootRequest;
 }
开发者ID:patrickreck,项目名称:flow-development-collection,代码行数:13,代码来源:ActionRequest.php

示例13: generateResetPasswordTokenForParty

 /**
  * @param AbstractParty $party
  * @param \TYPO3\Flow\Mvc\ActionRequest $request
  * @return \RFY\JsonApi\Users\Domain\Model\ResetToken
  * @throws \Exception
  * @throws \TYPO3\Flow\Exception
  */
 public function generateResetPasswordTokenForParty(AbstractParty $party, \TYPO3\Flow\Mvc\ActionRequest $request = NULL)
 {
     $account = $this->getAccountByParty($party);
     $request->getHttpRequest()->getClientIpAddress();
     return $this->generateResetPasswordToken($account, $request);
 }
开发者ID:rfyio,项目名称:RFY.JsonApi.Users,代码行数:13,代码来源:PasswordResetService.php


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