Returns true if we can successfully logon and fetch some data.

@return true     if can logon
770196
public boolean isValidToken() {
        try {
//            Response response = wsBase.path(TEST_CONFIGS).request(MediaType.APPLICATION_JSON_TYPE).get();
//            return response.getStatusInfo().getFamily() == Response.Status.Family.SUCCESSFUL;

            LoadZone zone = getLoadZone(LoadZone.AMAZON_US_ASHBURN.uid);
            return zone == LoadZone.AMAZON_US_ASHBURN;
        } catch (Exception e) {
            log.info("API token validation failed: " + e);
        }
        return false;
    }
325941
public function logout() {
		// Make sure we're logged in and have a valid access token.
		if (!$this->auth_token || !$this->username) {
			return FALSE;
		}

		$timestamp = parent::timestamp();
		$result = parent::post(
			'/logout',
			array(
				'timestamp' => $timestamp,
				'username' => $this->username,
			),
			array(
				$this->auth_token,
				$timestamp,
			)
		);

		// Clear out the cache in case the instance is recycled.
		$this->cache = NULL;

		return is_null($result);
	}
927233
private function requiresLogin(): bool
    {
        if ($this->requiresLogin) {
            return true;
        }

        $this->requiresLogin = $this->callbackAnnotatedWith->requiresLogin();
        return $this->requiresLogin;
    }
1351132
public function logout(): bool
    {
        if ($this->values->offsetExists('principal')) {
            $principal = $this->getPrincipal();
            $this->principal = Principal::getAnonymous();

            $this->session->destroy();

            $this->logger->info(
                "Authentication logout: {user}",
                ['user' => $principal]
            );
            return $this->publishLogout($principal);
        }
        return false;
    }
690957
public boolean hasPermission(Authentication authentication,
                                 Object resource,
                                 Object privilege) {
        boolean logPermission = isLogPermission(resource);
        return checkRole(authentication, privilege, logPermission)
            || checkPermission(authentication, resource, privilege, true, logPermission);
    }
161839
public static function is_loggedin() {
	if (self::is_active() == false) {
		return false;
	}
	if (self::get_user_id() == false) {
		return false;
	}
	
	return true;
}
483287
protected Boolean needAuth() {
        if (isBceKey.get()) {
            return false;
        }
        Calendar c = Calendar.getInstance();
        c.add(Calendar.DATE, 1);
        return !isAuthorized.get() || c.after(expireDate);
    }
6543
@Override
  public boolean canOpenWarm()
  {
    State state = _state;

    if (state == State.ACTIVE) {
      return true;
    }
    else if (state.isEnabled()) {
      long now = CurrentTime.currentTime();

      if (isFailed(now)) {
        return false;
      }

      long firstSuccessTime = _firstSuccessTime;
      int warmupState = 0;

      if (firstSuccessTime > 0) {
        warmupState = (int) ((now - firstSuccessTime) / _warmupChunkTime);
      }

      warmupState -= _currentFailCount;

      if (warmupState < 0) {
        return (_failTime - warmupState * _failChunkTime < now);
      }
      else if (WARMUP_MAX <= warmupState) {
        return true;
      }

      int connectionMax = WARMUP_CONNECTION_MAX[warmupState];

      int idleCount = getIdleCount();
      int activeCount = _activeCount.get() + _startingCount.get();
      int totalCount = activeCount + idleCount;
      
      return totalCount < connectionMax;
    }
    else {
      return false;
    }
  }
188501
boolean isResumable()
    {
    	if (tc.isEntryEnabled()) Tr.entry(tc, "isResumable");
        
        boolean isResumable = true;
        
        synchronized(_tokenMap)
        {
            if (!_tokenMap.isEmpty())
            {
            	isResumable = false;
            }
        }
        
        if (tc.isEntryEnabled()) Tr.exit(tc, "isResumable", new Boolean(isResumable));
        
        return isResumable;
    }
651746
public function isLogged()
    {
        $this->byPassIsLogged = true;
        try {
            // Is a session mechanism available?
            if (!session_id()) {
                if ($this->sessionManager) {
                    $this->sessionManager->start();
                } else {
                    throw new MoufException("The session must be initialized before checking if the user is logged. Please use session_start().");
                }
            }
            
            if (isset($_SESSION[$this->sessionPrefix.'MoufUserId'])) {
                return true;
            } else {
                foreach ($this->authProviders as $provider) {
                    /* @var $provider AuthenticationProviderInterface */
                    if ($provider->isLogged($this)) {
                        return true;
                    }
                }
            }
        } catch (\Exception $e) {
            $this->byPassIsLogged = false;
            throw $e;
        }
        $this->byPassIsLogged = false;
        return false;
    }
749104
public function isLocked()
    {
        if ($this->getFailuresNum() == \Dotdigitalgroup\Email\Model\FailedAuth::NUMBER_MAX_FAILS_LIMIT &&
            strtotime($this->getLastAttemptDate() . '+5 min') > time()) {
            return true;
        }

        return false;
    }
373202
public function isAuthenticated()
    {
        if (!$this->session->has('usr_id')) {
            return false;
        }

        if ($this->session->has('session_id')) {
            if (null !== $this->app['repo.sessions']->find($this->session->get('session_id'))) {
                return true;
            }
        }

        $this->session->invalidate();
        $this->reinitUser();

        return false;
    }
446221
public function isLoggedIn() {
        $hasUserData    = isset($this->_store->userData);
        $hasLoginMethod = isset($this->_store->method);
        $hasValidToken  = isset($this->_store->token) && $this->validateToken();
        $isLoggedIn     = $hasUserData && $hasLoginMethod && $hasValidToken;

        // Don't leave invalid cookies laying around.
        // Clear data only when data is present, but it is invalid.
        if ($hasUserData && $hasLoginMethod && !$hasValidToken) {
            $this->_store->userData = null;
            $this->_store->method   = null;
        }
        return $isLoggedIn;
    }
651283
public function logout()
    {
        if (!$this->hasSudoed()) {
            return false;
        }

        $this->auth->logout();

        $originalUserId = $this->session->get($this->sessionKey);

        if ($originalUserId) {
            $this->auth->loginUsingId($originalUserId);
        }

        $this->session->forget($this->sessionKey);
        $this->session->forget('sudosu.has_sudoed');

        return true;
    }
612445
@Override
    public boolean authenticate() {
        UndertowLogger.SECURITY_LOGGER.debugf("Attempting to authenticate %s, authentication required: %s", exchange.getRequestPath(), isAuthenticationRequired());
        if(authenticationState == AuthenticationState.ATTEMPTED || (authenticationState == AuthenticationState.CHALLENGE_SENT && !exchange.isResponseStarted())) {
            //we are re-attempted, so we just reset the state
            //see UNDERTOW-263
            authenticationState = AuthenticationState.NOT_ATTEMPTED;
        }
        return !authTransition();
    }
910133
public function validLoggedInAdmin()
    {
        $loggedInUser = $this->getCurrentLoggedInUser();
        if ($loggedInUser
            && $loggedInUser->administrator
            && $loggedInUser->deleted === null
            && $loggedInUser->enabled) {
                return true;
        }
        return false;
    }
16345
public function canLogin()
    {
        $subscriber_id = AnRequest::get('session.subscriber_id', 'cmd');

        if ($subscriber_id) {
            $this->person = $this->getService('repos:people.person')->find($subscriber_id);
        }

        return !is_null($this->person);
    }