{@inheritdoc}

The option 'totp' can be provided for two-factor authentication.
437201
public function getAccessToken($grant, array $options = [])
    {
        $grant = $this->verifyGrant($grant);

        $params = [
            'client_id' => $this->clientId,
            'client_secret' => $this->clientSecret,
            'redirect_uri' => $this->redirectUri,
        ];

        $params = $grant->prepareRequestParameters($params, $options);

        // Modify the request for TFA (two-factor authentication) support.
        $request = $this->getAccessTokenRequest($params);
        if ($grant->__toString() === 'password' && isset($options['totp'])) {
            $request = $request->withHeader(self::TFA_HEADER, $options['totp']);
        }

        $response = $this->getParsedResponse($request);
        $prepared = $this->prepareAccessTokenResponse($response);

        return $this->createAccessToken($prepared, $grant);
    }
1028560
public function verify($token, $identifier = null)
    {
        $identifier = ($identifier !== null) ? $identifier : $this->identifier;

        // Throw error for empty token or empty message id, because the server will not handle this
        if (empty($token)) {
            throw new Totp\EmptyTokenException();
        }
        if (empty($this->identifier)) {
            throw new Totp\EmptyIdentifierException();
        }

        try {
            $this->sendApiCall(self::ACTION_RETRIEVE, sprintf('totp/%s?token=%s', $identifier, $token));
        } catch (Exception $e) {
            if (Totp\Exception::isTotpException($e)) {
                throw new Totp\Exception($e);
            } else {
                throw $e;
            }
        }
    }
33766
final public function HTTPAuthenticate(
		$mode         = 'Basic',
		array $params = array()
	)
	{
		if (is_string($mode)) {
			$mode = ucwords(strtolower($mode));
		}
		if (! (is_string($mode) and in_array($mode, array('Basic', 'Digest')))) {
			$mode = 'Basic';
		}
		$params = array_filter($params, 'is_string');
		$params = array_merge(array('realm' => $_SERVER['HTTP_HOST']), $params);
		header(sprintf(
			'WWW-Authenticate: %s %s',
			$mode,
			join(', ', array_map(
				function($key, $val)
				{
					return $key . '="' . trim($val, '"') . '"';
				},
				array_keys($params),
				array_values($params)
			))
		));
		http_response_code(401);
	}
853937
public function sendEmail($emailFrom, $fromName, $emailTo, $toName = '', $replyTo = null, $subject, $message_html, $message_text = null, $transportConfig = null) {

	    $html = new MimePart($message_html);
	    $html->type = 'text/html';

	    $body = new MimeMessage();
	    
	    if ($message_text!=null){
	        
	        // Add Alternative Email Text Content
    	    $text = new MimePart($message_text);
    	    $text->type = 'text/plain';
    	    
    	    $body->addPart($html,$text);
    	    
	    }else{
	        $body->addPart($html);
	    }
	    
	    $message = new Message();
	    $message->setFrom($emailFrom, $fromName);
	    $message->addTo($emailTo);
	    $message->setSubject($subject);
	    $message->setEncoding('UTF-8');
	    $message->setSender($emailTo, $toName);
	    $message->setBody($body);
	    if ($replyTo!=null){
	        $message->addReplyTo($replyTo);
	    }

        $transport = new Sendmail();

        if(is_array($transportConfig) && $transportConfig) {
            /**
             * Program executes these lines when user passes
             * custom Transport Configuration Options ($transportConfig)
             * to specify their own Mailing Service Provider
             */
            try{
                // Setup SMTP transport using LOGIN authentication
                $transport = new SmtpTransport();
                $options   = new SmtpOptions(array(
                    'name'              => $transportConfig['name'],
                    'host'              => $transportConfig['host'],
                    'connection_class'  => $transportConfig['connectionClass'],
                    'connection_config' => array(
                        'username' => $transportConfig['username'],
                        'password' => $transportConfig['password'],
                        'ssl' => $transportConfig['ssl'],
                    ),
                    'port' => $transportConfig['port'],
                ));
                $transport->setOptions($options);
            }
            catch (\Exception $exception){
                throw new \Exception($exception->getMessage());
            }
        }

        $transport->send($message);
	}
634413
@Deprecated
    public B sslContext(
            SessionProtocol protocol,
            File keyCertChainFile, File keyFile, @Nullable String keyPassword) throws SSLException {

        if (requireNonNull(protocol, "protocol") != SessionProtocol.HTTPS) {
            throw new IllegalArgumentException("unsupported protocol: " + protocol);
        }

        return tls(keyCertChainFile, keyFile, keyPassword);
    }
125728
public function backupTotp(AccountTwoFactorTotpBackupRequest $request)
    {
        $currentUser = $request->user($this->getGuard());
        $twoFactor = $currentUser->getTwoFactor();
        $twoFactor['totp']['backup'] = $this->generateTotpBackups();
        $twoFactor['totp']['backup_at'] = now()->toDateTimeString();

        $currentUser->fill(['two_factor' => $twoFactor])->forceSave();

        return intend([
            'back' => true,
            'with' => ['success' => trans('cortex/auth::messages.verification.twofactor.totp.rebackup')],
        ]);
    }
404719
public static function verify($secret, $code)
    {
        $otp = new TOTP(null, $secret);
        return $otp->verify($code);
    }
506721
public SMTPClientFuture<Collection<FutureResult<Iterator<DeliveryRecipientStatus>>>> deliver(InetSocketAddress host, final SMTPDeliveryAgentConfig config, final SMTPDeliveryEnvelope... transactions) {
        if (transactions == null || transactions.length == 0) {
            throw new IllegalArgumentException("SMTPTransaction parameter must be not null and the length must be > 0");
        }

        final SMTPClientFutureImpl<Collection<FutureResult<Iterator<DeliveryRecipientStatus>>>> future = new SMTPClientFutureImpl<Collection<FutureResult<Iterator<DeliveryRecipientStatus>>>>();
        final SMTPClientFutureListenerFactory factory = createFactory();
        
        transport.connect(host, config).addListener(new ChainedSMTPClientFutureListener<SMTPResponse>() {
          

            @Override
            public void onException(SMTPClientSession session, SMTPException t) {
                initSession(session);
                super.onException(session, t);
            
            }
           
            /**
             * Init the SMTPClienSesion by adding all needed data to the attributes
             * 
             * @param session
             */
            private void initSession(SMTPClientSession session) {
                
                
                Iterator<SMTPDeliveryEnvelope> transactionIt = new ArrayIterator<SMTPDeliveryEnvelope>(transactions);
                session.setAttribute(SMTP_TRANSACTIONS_KEY, transactionIt);
                SMTPDeliveryEnvelope transaction = transactionIt.next();
                session.setAttribute(CURRENT_SMTP_TRANSACTION_KEY, transaction);
                session.setAttribute(RECIPIENTS_KEY, transaction.getRecipients().iterator());

                session.setAttribute(FUTURE_KEY, future);
                session.setAttribute(DELIVERY_STATUS_KEY, new ArrayList<DeliveryRecipientStatus>());
                session.setAttribute(DELIVERY_RESULT_LIST_KEY, new ArrayList<FutureResult<Iterator<DeliveryRecipientStatus>>>());
                session.setAttribute(SMTP_CLIENT_FUTURE_LISTENER_FACTORY, createFactory());
                session.setAttribute(SMTP_TRANSACTION_ACTIVE_KEY, false);
            }

            @Override
            protected void onResult(SMTPClientSession session, SMTPResponse result) throws SMTPException {
                initSession(session);
                FutureResult<SMTPResponse> fResult = new FutureResultImpl<SMTPResponse>(result);
                ReadySMTPClientFuture<FutureResult<SMTPResponse>> future = new ReadySMTPClientFuture<FutureResult<SMTPResponse>>(session, fResult);
                future.addListener(factory.getListener(session));                
            }
        });
        
       
        return future;
    }
22424
public function authenticate()
    {
        $optionsRequired = array('filename', 'realm', 'username', 'password');
        foreach ($optionsRequired as $optionRequired) {
            if (null === $this->{"_$optionRequired"}) {
                /**
                 * @see Zend_Auth_Adapter_Exception
                 */
                require_once 'Zend/Auth/Adapter/Exception.php';
                throw new Zend_Auth_Adapter_Exception("Option '$optionRequired' must be set before authentication");
            }
        }

        if (false === ($fileHandle = @fopen($this->_filename, 'r'))) {
            /**
             * @see Zend_Auth_Adapter_Exception
             */
            require_once 'Zend/Auth/Adapter/Exception.php';
            throw new Zend_Auth_Adapter_Exception("Cannot open '$this->_filename' for reading");
        }

        $id       = "$this->_username:$this->_realm";
        $idLength = strlen($id);

        $result = array(
            'code'  => Zend_Auth_Result::FAILURE,
            'identity' => array(
                'realm'    => $this->_realm,
                'username' => $this->_username,
                ),
            'messages' => array()
            );

        while ($line = trim(fgets($fileHandle))) {
            if (substr($line, 0, $idLength) === $id) {
                if ($this->_secureStringCompare(substr($line, -32), md5("$this->_username:$this->_realm:$this->_password"))) {
                    $result['code'] = Zend_Auth_Result::SUCCESS;
                } else {
                    $result['code'] = Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID;
                    $result['messages'][] = 'Password incorrect';
                }
                return new Zend_Auth_Result($result['code'], $result['identity'], $result['messages']);
            }
        }

        $result['code'] = Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND;
        $result['messages'][] = "Username '$this->_username' and realm '$this->_realm' combination not found";
        return new Zend_Auth_Result($result['code'], $result['identity'], $result['messages']);
    }
880397
def authenticate(credentials, sock_info):
    """"""
    mechanism = credentials.mechanism
    auth_func = _AUTH_MAP.get(mechanism)
    auth_func(credentials, sock_info)
417038
public function createTotp($identifier, $issuer = null)
    {
        $totp = $this->createEmptyTotp();
        $totp->setIdentifier($identifier);
        if (null !== $issuer) {
            $totp->setIssuer($issuer);
        }

        return $totp;
    }
533792
function sendHideManialinkPage($recipient = null, $multicall = false)
    {
        $logins = $this->getLogins($recipient, true);
        if ($logins === false) {
            throw new InvalidArgumentException('recipient = ' . print_r($recipient, true));
        }

        if ($logins) {
            return $this->execute(ucfirst(__FUNCTION__) . 'ToLogin', array($logins), $multicall);
        }
        return $this->execute(ucfirst(__FUNCTION__), array(), $multicall);
    }
493553
public function sendAcceptSubscriptionRequest($to)
    {
        $presence = new \sb\XMPP\Presence();
        $presence->setType('subscribed');
        $presence->setTo($to);
        return $this->sendPresence($presence);
    }
1333669
@Override
    void authenticate(Map<String, Object> options) {
        final Map<String, Object> auth = new HashMap<>();
        auth.put(AbstractReplicatorConfiguration.REPLICATOR_AUTH_TYPE, AbstractReplicatorConfiguration.AUTH_TYPE_BASIC);
        auth.put(AbstractReplicatorConfiguration.REPLICATOR_AUTH_USER_NAME, username);
        auth.put(AbstractReplicatorConfiguration.REPLICATOR_AUTH_PASSWORD, password);
        options.put(AbstractReplicatorConfiguration.REPLICATOR_AUTH_OPTION, auth);
    }
1054092
public function connectAndAuthenticate() {
		// 1. connect
		if (!$this->isConnected()) {
			$this->connect();
		}
		$this->hello();
		
		// 2. open tls connection if needed
		$securityMode = $this->config->getSecurityMode();
		if ($securityMode == SmtpConfig::SECURITY_MODE_TLS) {
			$this->startTls();
			$this->hello();
		}
		
		// 3. authenticat if needed
		if ($this->config->doAuthenticate()) {
			$this->authenticate();
		}
	}
585254
def build_request_cancelar_transacao numero_transacao
      # Montar os parâmetros para consulta
      params = {
        operacao: {
          codigo_estabelecimento: SuperpayApi.estabelecimento,
          numero_transacao: numero_transacao,
          operacao: 2,
        }
      }
      # Adiciona as configurações de login
      params.merge! SuperpayApi.login
    end
754786
public function authenticate() {
		$this->sendMessage('AUTH LOGIN', 334, 'SMTP AUTH not accepted from server');
		$this->sendMessage($this->config->getUser(), 334, 'SMTP username not accepted from server', true);
		$this->sendMessage($this->config->getPassword(), 235, 'SMTP password not accepted from server', true);
	}