Check if the guard applies to the request,
then apply the assigned assertion.

@param  \Zend\Stdlib\RequestInterface $uri
@return bool
326895
public function isAllowed(RequestInterface $uri)
    {
        if (preg_match(sprintf('#^%s$#', $this->regexp), $uri->getUri()->getPath())) {
            if (isset($this->assertion)) {
                $assertion = $this->assertion;

                return $assertion();
            } else {
                return true;
            }
        }

        return true;
    }
869011
public function matchRequest(\TYPO3\Flow\Mvc\RequestInterface $request) {
		/** @var \TYPO3\Flow\Security\RequestPatternInterface $pattern */
		foreach ($this->subPatterns as $pattern) {
			if ($pattern->matchRequest($request) === FALSE) {
				return FALSE;
			}
		}

		return TRUE;
	}
551064
public function applyPreInterceptors(Request $request, Response $response): bool
    {
        if ($this->isAuthorized($request, $response)) {
            return $this->actualResource->applyPreInterceptors($request, $response);
        }

        return true;
    }
854547
public function isAccessible(SecurableInterface $securable)
    {
        $allowedRoles = $securable->getAllowedRoles();

        if (empty($allowedRoles)) {
            return true;
        }

        $authorizationChecker = $this->getAuthorizationChecker();

        foreach ($allowedRoles as $allowedRole) {
            if ($authorizationChecker->isGranted($allowedRole)) {
                return true;
            }
        }

        return false;
    }
975639
public static function isRelativePath($uri): bool
    {
        $uri = self::filterUri($uri);
        $null = $uri instanceof Psr7UriInterface ? '' : null;

        return $null === $uri->getScheme()
            && $null === $uri->getAuthority()
            && '/' !== ($uri->getPath()[0] ?? '');
    }
1251301
function match(RequestInterface $request)
    {
        if (strtoupper($request->getMethod()) !== $this->getMethod())
            return false;

        return parent::match($request);
    }
112694
public function requestHasToken(RequestInterface $request)
    {
        $headers = $request->headers('AUTHORIZATION');

        // check the header, then the querystring, then the request body
        return !empty($headers) || (bool) ($request->request($this->config['token_param_name'])) || (bool) ($request->query($this->config['token_param_name']));
    }
731793
public static function isNetworkPath($uri): bool
    {
        $uri = self::filterUri($uri);
        $null = $uri instanceof Psr7UriInterface ? '' : null;

        return $null === $uri->getScheme() && $null !== $uri->getAuthority();
    }
79591
public function validateRequest(RequestInterface $request, ResponseInterface $response)
	{
		// check for session id
		if (!$sessionId = $this->storage->getSessionIdFromCookie())
		{
			$response->setError(401, 'session_authentication_invalid', 'Unable to find a valid session id.');
			return false;
		}

		// get user for session id
		if (!$userId = $this->storage->getUserIdFromSessionId($sessionId))
		{
			$response->setError(401, 'session_authentication_invalid', 'Unable to authenticate via active session.');
			return false;
		}

		// store our session & user id
		$this->userInfo = array(
			'user_id'    => $userId,
			'session_id' => $sessionId
		);
		return true;
	}
924720
public function init(RequestInterface $request)
    {
        $translator = $this->translator();

        $notice = $request->getParam('notice');
        switch ($notice) {
            case 'resetpass':
                $message = $translator->translate('Check your email for instructions to reset your password.');
                $this->addFeedback([
                    'level'       => 'notice',
                    'message'     => $message,
                    'dismissible' => false
                ]);
                break;

            case 'newpass':
                $message = $translator->translate('Log in with your new password.');
                $this->addFeedback([
                    'level'       => 'notice',
                    'message'     => $message,
                    'dismissible' => false
                ]);
                break;
        }

        return true;
    }
204042
public static function check($uri)
    {
        try {
            $uri = self::factory($uri);
        } catch (Exception $e) {
            return false;
        }

        return $uri->valid();
    }
411076
public function verifyResourceRequest(RequestInterface $request, ResponseInterface $response, $scope = null)
    {
        $token = $this->getAccessTokenData($request, $response);

        // Check if we have token data
        if (is_null($token)) {
            return false;
        }

        /**
         * Check scope, if provided
         * If token doesn't have a scope, it's null/empty, or it's insufficient, then throw 403
         * @see http://tools.ietf.org/html/rfc6750#section-3.1
         */
        if ($scope && (!isset($token["scope"]) || !$token["scope"] || !$this->scopeUtil->checkScope($scope, $token["scope"]))) {
            $response->setError(403, 'insufficient_scope', 'The request requires higher privileges than provided by the access token');
            $response->addHttpHeaders(array(
                'WWW-Authenticate' => sprintf('%s realm="%s", scope="%s", error="%s", error_description="%s"',
                    $this->tokenType->getTokenType(),
                    $this->config['www_realm'],
                    $scope,
                    $response->getParameter('error'),
                    $response->getParameter('error_description')
                )
            ));

            return false;
        }

        // allow retrieval of the token
        $this->token = $token;

        return (bool) $token;
    }
1183271
protected function getUriInterface($uri)
    {
        if ($uri instanceof UriInterface) {
            return UriInterface::class;
        }

        if ($uri instanceof Uri) {
            return Uri::class;
        }

        throw Exception::fromInvalidUri($uri);
    }
1270813
public function isValid(string $uri = ''): bool
    {
        return !empty($this->value) && $this->isNotExpired() && $this->isThere($uri);
    }
202931
private function isAccessAuthorized($uri)
    {
        foreach ($this->forbiddenUriPatterns as $forbiddenUriPattern)
        {
            if (preg_match("@$forbiddenUriPattern@", $uri))
            {
                return false;
            }
        }
        return true;
    }
763238
public function check($uri)
    {
        $url = parse_url($uri);
        if (isset($url['query'])) {
            parse_str($url['query'], $params);
        } else {
            $params = [];
        }

        if (empty($params[$this->parameter])) {
            return false;
        }

        $hash = $params[$this->parameter];
        unset($params[$this->parameter]);

        return $this->computeHash($this->buildUrl($url, $params)) === $hash;
    }
814726
public function isActiveGuard(Request $request, $guard)
    {
        $name = Auth::guard($guard)->getName();

        return ($this->sessionHas($request, $name) && $this->sessionGet($request,
                $name) === $this->getAuthIdentifier($guard));
    }