Horde_Registry::isAuthenticated PHP Method

isAuthenticated() public method

Checks if there is a session with valid auth information. If there isn't, but the configured Auth driver supports transparent authentication, then we try that.
public isAuthenticated ( array $opts = [] ) : boolean
$opts array Additional options: - app: (string) Check authentication for this app. DEFAULT: Checks horde-wide authentication. - notransparent: (boolean) Do not attempt transparent authentication. DEFAULT: false
return boolean Whether or not the user is authenticated.
    public function isAuthenticated(array $opts = array())
    {
        global $injector, $session;
        $app = empty($opts['app']) ? 'horde' : $opts['app'];
        $transparent = intval(empty($opts['notransparent']));
        if (isset($this->_cache['isauth'][$app][$transparent])) {
            return $this->_cache['isauth'][$app][$transparent];
        }
        /* Check for cached authentication results. */
        if ($this->getAuth() && ($app == 'horde' || $session->exists('horde', 'auth_app/' . $app)) && $this->checkExistingAuth($app)) {
            $res = true;
        } elseif ($transparent) {
            try {
                $res = $injector->getInstance('Horde_Core_Factory_Auth')->create($app)->transparent();
            } catch (Horde_Exception $e) {
                Horde::log($e);
                $res = false;
            }
        } else {
            $res = false;
        }
        $this->_cache['isauth'][$app][$transparent] = $res;
        return $res;
    }