public static function authorizeApplication( $clientId, $endPointUri, $clientSecret = null )
    {
        $client = self::fetchByClientId( $clientId );

        // no client found with this ID
        if ( $client === false )
            return false;

        if ( $clientSecret !== null && ( $clientSecret !== $client->client_secret ) )
            return false;

        if ( ( $client->endpoint_uri !== '' ) && ( $endPointUri !== $client->endpoint_uri ) )
            return false;

        return true;
    }