protected function getUsernamePasswordToken(Request $request)
    {
        if ($this->options['post_only']) {
            $username = trim($this->getParameterFromBag($request->request, $this->options['username_parameter']));
            $password = $this->getParameterFromBag($request->request, $this->options['password_parameter']);
        } else {
            $username = trim($this->getParameterFromRequest($request, $this->options['username_parameter']));
            $password = $this->getParameterFromRequest($request, $this->options['password_parameter']);
        }
        $request->getSession()->set(Security::LAST_USERNAME, $username);

        $token = new UsernamePasswordToken($username, $password, $this->providerKey);
        $this->addDomainToTokenIfPresent($request, $token);

        return $token;
    }
protected function getUsernamePasswordToken(Request $request)
    {
        if ($this->options['post_only']) {
            $username = trim($this->getParameterFromBag($request->request, $this->options['username_parameter']));
            $password = $this->getParameterFromBag($request->request, $this->options['password_parameter']);
        } else {
            $username = trim($this->getParameterFromRequest($request, $this->options['username_parameter']));
            $password = $this->getParameterFromRequest($request, $this->options['password_parameter']);
        }
        $request->getSession()->set(Security::LAST_USERNAME, $username);

        $token = new UsernamePasswordToken($username, $password, $this->providerKey);
        $this->addDomainToTokenIfPresent($request, $token);

        return $token;
    }
protected function getUsernamePasswordToken ( Request $ request ) { if ( $ this -> options [ 'post_only' ] ) { $ username = trim ( $ this -> getParameterFromBag ( $ request -> request , $ this -> options [ 'username_parameter' ] ) ) ; $ password = $ this -> getParameterFromBag ( $ request -> request , $ this -> options [ 'password_parameter' ] ) ; } else { $ username = trim ( $ this -> getParameterFromRequest ( $ request , $ this -> options [ 'username_parameter' ] ) ) ; $ password = $ this -> getParameterFromRequest ( $ request , $ this -> options [ 'password_parameter' ] ) ; } $ request -> getSession ( ) -> set ( Security :: LAST_USERNAME , $ username ) ; $ token = new UsernamePasswordToken ( $ username , $ password , $ this -> providerKey ) ; $ this -> addDomainToTokenIfPresent ( $ request , $ token ) ; return $ token ; }
Get the UsernamePasswordToken based off the Request parameters.

@param Request $request
@return UsernamePasswordToken
Get the UsernamePasswordToken based off the Request parameters .