src/Components/AlternateAuth.php
protected function getRemoteUser($filter)
    {
        $resource = '_table/' . $this->table;
        $response = ServiceManager::handleRequest(
            $this->service,
            Verbs::GET,
            $resource,
            ['filter' => $filter],
            [], null, null, false
        );
        $status = $response->getStatusCode();

        if ($status === 200) {
            $result = ResourcesWrapper::unwrapResources($response->getContent());
            if (!Arr::isAssoc($result)) {
                if (count($result) > 1) {
                    throw new InternalServerErrorException('An unexpected error occurred. More than one user found with your credentials!');
                }
                if (count($result) === 0) {
                    throw new UnauthorizedException('Invalid user information provided.');
                }
                $result = $result[0];
            }

            return $result;
        } else {
            $message = 'DB service responded with code ' . $status;
            if ($status >= 400) {
                $content = $response->getContent();
                $message = array_get($content, 'error.message', $message);
            } else {
                $status = 500;
            }
            throw new RestException($status, $message);
        }
    }
protected function getRemoteUser($filter)
    {
        $resource = '_table/' . $this->table;
        $response = ServiceManager::handleRequest(
            $this->service,
            Verbs::GET,
            $resource,
            ['filter' => $filter],
            [], null, null, false
        );
        $status = $response->getStatusCode();

        if ($status === 200) {
            $result = ResourcesWrapper::unwrapResources($response->getContent());
            if (!Arr::isAssoc($result)) {
                if (count($result) > 1) {
                    throw new InternalServerErrorException('An unexpected error occurred. More than one user found with your credentials!');
                }
                if (count($result) === 0) {
                    throw new UnauthorizedException('Invalid user information provided.');
                }
                $result = $result[0];
            }

            return $result;
        } else {
            $message = 'DB service responded with code ' . $status;
            if ($status >= 400) {
                $content = $response->getContent();
                $message = array_get($content, 'error.message', $message);
            } else {
                $status = 500;
            }
            throw new RestException($status, $message);
        }
    }
protected function getRemoteUser ( $ filter ) { $ resource = '_table/' . $ this -> table ; $ response = ServiceManager :: handleRequest ( $ this -> service , Verbs :: GET , $ resource , [ 'filter' => $ filter ] , [ ] , null , null , false ) ; $ status = $ response -> getStatusCode ( ) ; if ( $ status === 200 ) { $ result = ResourcesWrapper :: unwrapResources ( $ response -> getContent ( ) ) ; if ( ! Arr :: isAssoc ( $ result ) ) { if ( count ( $ result ) > 1 ) { throw new InternalServerErrorException ( 'An unexpected error occurred. More than one user found with your credentials!' ) ; } if ( count ( $ result ) === 0 ) { throw new UnauthorizedException ( 'Invalid user information provided.' ) ; } $ result = $ result [ 0 ] ; } return $ result ; } else { $ message = 'DB service responded with code ' . $ status ; if ( $ status >= 400 ) { $ content = $ response -> getContent ( ) ; $ message = array_get ( $ content , 'error.message' , $ message ) ; } else { $ status = 500 ; } throw new RestException ( $ status , $ message ) ; } }
Retrieves the user from remote source

@param $filter

@return mixed
@throws \DreamFactory\Core\Exceptions\BadRequestException
@throws \DreamFactory\Core\Exceptions\InternalServerErrorException
@throws \DreamFactory\Core\Exceptions\RestException
@throws \DreamFactory\Core\Exceptions\UnauthorizedException
@throws \Exception
Retrieves the user from remote source