Piwik\Plugins\Login\Auth::authenticate PHP Méthode

authenticate() public méthode

Authenticates user
public authenticate ( ) : Piwik\AuthResult
Résultat Piwik\AuthResult
    public function authenticate()
    {
        if (!empty($this->hashedPassword)) {
            return $this->authenticateWithPassword($this->login, $this->getTokenAuthSecret());
        } elseif (is_null($this->login)) {
            return $this->authenticateWithToken($this->token_auth);
        } elseif (!empty($this->login)) {
            return $this->authenticateWithTokenOrHashToken($this->token_auth, $this->login);
        }
        return new AuthResult(AuthResult::FAILURE, $this->login, $this->token_auth);
    }

Usage Example

Exemple #1
0
 /**
  * Authenticates user
  *
  * @return \Piwik\AuthResult
  */
 public function authenticate()
 {
     $httpLogin = $this->getHttpAuthLogin();
     if (!empty($httpLogin)) {
         $user = $this->userModel->getUser($httpLogin);
         if (empty($user)) {
             return new AuthResult(AuthResult::FAILURE, $httpLogin, null);
         }
         $code = !empty($user['superuser_access']) ? AuthResult::SUCCESS_SUPERUSER_AUTH_CODE : AuthResult::SUCCESS;
         return new AuthResult($code, $httpLogin, $user['token_auth']);
     }
     return parent::authenticate();
 }
All Usage Examples Of Piwik\Plugins\Login\Auth::authenticate