src/Grant/AbstractGrant.php
protected function validateClient(ServerRequestInterface $request)
    {
        list($basicAuthUser, $basicAuthPassword) = $this->getBasicAuthCredentials($request);

        $clientId = $this->getRequestParameter('client_id', $request, $basicAuthUser);
        if ($clientId === null) {
            throw OAuthServerException::invalidRequest('client_id');
        }

        // If the client is confidential require the client secret
        $clientSecret = $this->getRequestParameter('client_secret', $request, $basicAuthPassword);

        $client = $this->clientRepository->getClientEntity(
            $clientId,
            $this->getIdentifier(),
            $clientSecret,
            true
        );

        if ($client instanceof ClientEntityInterface === false) {
            $this->getEmitter()->emit(new RequestEvent(RequestEvent::CLIENT_AUTHENTICATION_FAILED, $request));
            throw OAuthServerException::invalidClient();
        }

        $redirectUri = $this->getRequestParameter('redirect_uri', $request, null);

        if ($redirectUri !== null) {
            $this->validateRedirectUri($redirectUri, $client, $request);
        }

        return $client;
    }
protected function validateClient(ServerRequestInterface $request)
    {
        list($basicAuthUser, $basicAuthPassword) = $this->getBasicAuthCredentials($request);

        $clientId = $this->getRequestParameter('client_id', $request, $basicAuthUser);
        if ($clientId === null) {
            throw OAuthServerException::invalidRequest('client_id');
        }

        // If the client is confidential require the client secret
        $clientSecret = $this->getRequestParameter('client_secret', $request, $basicAuthPassword);

        $client = $this->clientRepository->getClientEntity(
            $clientId,
            $this->getIdentifier(),
            $clientSecret,
            true
        );

        if ($client instanceof ClientEntityInterface === false) {
            $this->getEmitter()->emit(new RequestEvent(RequestEvent::CLIENT_AUTHENTICATION_FAILED, $request));
            throw OAuthServerException::invalidClient();
        }

        $redirectUri = $this->getRequestParameter('redirect_uri', $request, null);

        if ($redirectUri !== null) {
            $this->validateRedirectUri($redirectUri, $client, $request);
        }

        return $client;
    }
protected function validateClient ( ServerRequestInterface $ request ) { list ( $ basicAuthUser , $ basicAuthPassword ) = $ this -> getBasicAuthCredentials ( $ request ) ; $ clientId = $ this -> getRequestParameter ( 'client_id' , $ request , $ basicAuthUser ) ; if ( $ clientId === null ) { throw OAuthServerException :: invalidRequest ( 'client_id' ) ; } // If the client is confidential require the client secret $ clientSecret = $ this -> getRequestParameter ( 'client_secret' , $ request , $ basicAuthPassword ) ; $ client = $ this -> clientRepository -> getClientEntity ( $ clientId , $ this -> getIdentifier ( ) , $ clientSecret , true ) ; if ( $ client instanceof ClientEntityInterface === false ) { $ this -> getEmitter ( ) -> emit ( new RequestEvent ( RequestEvent :: CLIENT_AUTHENTICATION_FAILED , $ request ) ) ; throw OAuthServerException :: invalidClient ( ) ; } $ redirectUri = $ this -> getRequestParameter ( 'redirect_uri' , $ request , null ) ; if ( $ redirectUri !== null ) { $ this -> validateRedirectUri ( $ redirectUri , $ client , $ request ) ; } return $ client ; }
Validate the client.

@param ServerRequestInterface $request

@throws OAuthServerException

@return ClientEntityInterface
Validate the client .