/** * 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; } }
/** * @return void * @internal */ protected function initializeCurrentPageFromRequest() { if (!$this->formState->isFormSubmitted()) { $this->currentPage = $this->formDefinition->getPageByIndex(0); return; } $this->lastDisplayedPage = $this->formDefinition->getPageByIndex($this->formState->getLastDisplayedPageIndex()); // We know now that lastDisplayedPage is filled $currentPageIndex = (int) $this->request->getInternalArgument('__currentPage'); if ($currentPageIndex > $this->lastDisplayedPage->getIndex() + 1) { // We only allow jumps to following pages $currentPageIndex = $this->lastDisplayedPage->getIndex() + 1; } // We now know that the user did not try to skip a page if ($currentPageIndex === count($this->formDefinition->getPages())) { // Last Page $this->currentPage = NULL; } else { $this->currentPage = $this->formDefinition->getPageByIndex($currentPageIndex); } }
/** * 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; } }
/** * Initialize the property mapping configuration in $controllerArguments if * the trusted properties are set inside the request. * * @param \TYPO3\Flow\Mvc\ActionRequest $request * @param \TYPO3\Flow\Mvc\Controller\Arguments $controllerArguments * @return void */ public function initializePropertyMappingConfigurationFromRequest(\TYPO3\Flow\Mvc\ActionRequest $request, \TYPO3\Flow\Mvc\Controller\Arguments $controllerArguments) { $trustedPropertiesToken = $request->getInternalArgument('__trustedProperties'); if (!is_string($trustedPropertiesToken)) { return; } $serializedTrustedProperties = $this->hashService->validateAndStripHmac($trustedPropertiesToken); $trustedProperties = unserialize($serializedTrustedProperties); foreach ($trustedProperties as $propertyName => $propertyConfiguration) { if (!$controllerArguments->hasArgument($propertyName)) { continue; } $propertyMappingConfiguration = $controllerArguments->getArgument($propertyName)->getPropertyMappingConfiguration(); $this->modifyPropertyMappingConfiguration($propertyConfiguration, $propertyMappingConfiguration); } }
/** * @test */ public function internalArgumentsMayHaveObjectValues() { $someObject = new \stdClass(); $this->actionRequest->setArgument('__someInternalArgument', $someObject); $this->assertSame($someObject, $this->actionRequest->getInternalArgument('__someInternalArgument')); }
/** * @test */ public function internalArgumentsMayHaveObjectValues() { $httpRequest = HttpRequest::create(new Uri('http://robertlemke.com/blog')); $someObject = new \stdClass(); $actionRequest = new ActionRequest($httpRequest); $actionRequest->setArgument('__someInternalArgument', $someObject); $this->assertSame($someObject, $actionRequest->getInternalArgument('__someInternalArgument')); }