public function check(RequestInterface $request, ResponseInterface $response)
    {
        if (!$this->backends) {
            throw new \Sabre\DAV\Exception('No authentication backends were configured on this server.');
        }
        $reasons = [];
        foreach ($this->backends as $backend) {
            $result = $backend->check(
                $request,
                $response
            );

            if (!is_array($result) || 2 !== count($result) || !is_bool($result[0]) || !is_string($result[1])) {
                throw new \Sabre\DAV\Exception('The authentication backend did not return a correct value from the check() method.');
            }

            if ($result[0]) {
                $this->currentPrincipal = $result[1];
                // Exit early
                return [true, $result[1]];
            }
            $reasons[] = $result[1];
        }

        return [false, $reasons];
    }
public function check(RequestInterface $request, ResponseInterface $response)
    {
        if (!$this->backends) {
            throw new \Sabre\DAV\Exception('No authentication backends were configured on this server.');
        }
        $reasons = [];
        foreach ($this->backends as $backend) {
            $result = $backend->check(
                $request,
                $response
            );

            if (!is_array($result) || 2 !== count($result) || !is_bool($result[0]) || !is_string($result[1])) {
                throw new \Sabre\DAV\Exception('The authentication backend did not return a correct value from the check() method.');
            }

            if ($result[0]) {
                $this->currentPrincipal = $result[1];
                // Exit early
                return [true, $result[1]];
            }
            $reasons[] = $result[1];
        }

        return [false, $reasons];
    }
public function check ( RequestInterface $ request , ResponseInterface $ response ) { if ( ! $ this -> backends ) { throw new \ Sabre \ DAV \ Exception ( 'No authentication backends were configured on this server.' ) ; } $ reasons = [ ] ; foreach ( $ this -> backends as $ backend ) { $ result = $ backend -> check ( $ request , $ response ) ; if ( ! is_array ( $ result ) || 2 !== count ( $ result ) || ! is_bool ( $ result [ 0 ] ) || ! is_string ( $ result [ 1 ] ) ) { throw new \ Sabre \ DAV \ Exception ( 'The authentication backend did not return a correct value from the check() method.' ) ; } if ( $ result [ 0 ] ) { $ this -> currentPrincipal = $ result [ 1 ] ; // Exit early return [ true , $ result [ 1 ] ] ; } $ reasons [ ] = $ result [ 1 ] ; } return [ false , $ reasons ] ; }
Checks authentication credentials, and logs the user in if possible.

This method returns an array. The first item in the array is a boolean
indicating if login was successful.

If login was successful, the second item in the array will contain the
current principal url/path of the logged in user.

If login was not successful, the second item in the array will contain a
an array with strings. The strings are a list of reasons why login was
unsuccessful. For every auth backend there will be one reason, so usually
there's just one.

@param RequestInterface  $request
@param ResponseInterface $response

@return array
Checks authentication credentials and logs the user in if possible .