public function getOauthConsumer(\common_http_Credentials $credentials)
	{
        if (!$credentials instanceof \core_kernel_classes_Resource) {
            throw new \tao_models_classes_oauth_Exception('Unsupported credential type '.get_class($credentials));
        }
	    $values = $credentials->getPropertiesValues(array(
			self::PROPERTY_OAUTH_KEY,
			self::PROPERTY_OAUTH_SECRET,
			self::PROPERTY_OAUTH_CALLBACK
	    ));
	    if (empty($values[self::PROPERTY_OAUTH_KEY]) || empty($values[self::PROPERTY_OAUTH_SECRET])) {
	        throw new \tao_models_classes_oauth_Exception('Incomplete oauth consumer definition for '.$credentials->getUri());
	    }
	    $consumer_key = (string)current($values[self::PROPERTY_OAUTH_KEY]);
	    $secret = (string)current($values[self::PROPERTY_OAUTH_SECRET]);
	    if (!empty($values[self::PROPERTY_OAUTH_CALLBACK])) {
	        $callbackUrl = (string)current($values[self::PROPERTY_OAUTH_CALLBACK]);
	        if (empty($callbackUrl)) {
	            $callbackUrl = null;
	        }
	    } else {
	        $callbackUrl = null;
	    }
        return new OAuthConsumer($consumer_key, $secret, $callbackUrl);
	}