Piwik\Plugins\Login\Auth::authenticate PHP Method

authenticate() public method

Authenticates user
public authenticate ( ) : Piwik\AuthResult
return 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

Ejemplo n.º 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