/** * 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); } }
/** * 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); } }
/** * 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); } }
/** * @test */ public function internalArgumentsOfActionRequestOverruleThoseOfTheHttpRequest() { $this->actionRequest->setArguments(array('__internalArgument' => 'action request')); $expectedResult = array('__internalArgument' => 'action request'); $this->assertSame($expectedResult, $this->actionRequest->getInternalArguments()); }
/** * @test */ public function internalArgumentsAreHandledSeparately() { $httpRequest = HttpRequest::create(new Uri('http://robertlemke.com/blog')); $actionRequest = new ActionRequest($httpRequest); $actionRequest->setArgument('__someInternalArgument', 'theValue'); $this->assertFalse($actionRequest->hasArgument('__someInternalArgument')); $this->assertEquals('theValue', $actionRequest->getInternalArgument('__someInternalArgument')); $this->assertEquals(array('__someInternalArgument' => 'theValue'), $actionRequest->getInternalArguments()); }