Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/253.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php OAuth签名不适用于OSLC HTTP Post_Php_Cakephp_Oauth_Oslc - Fatal编程技术网

Php OAuth签名不适用于OSLC HTTP Post

Php OAuth签名不适用于OSLC HTTP Post,php,cakephp,oauth,oslc,Php,Cakephp,Oauth,Oslc,我正试图发布到IBMRRC(RationalRequirementsComposer)实例。我已经通过OAuth进行了身份验证,我的所有Get命令似乎都正常运行。但是,当我提交帖子时,服务器的响应是: Oauth authentication is required. 下面是我正在使用的Get和Post命令的示例: 这很有效 array( 'method' => 'GET', 'uri' => array( 'host' => '*****', 'po

我正试图发布到IBMRRC(RationalRequirementsComposer)实例。我已经通过OAuth进行了身份验证,我的所有Get命令似乎都正常运行。但是,当我提交帖子时,服务器的响应是:

Oauth authentication is required.
下面是我正在使用的Get和Post命令的示例:

这很有效

array(
  'method' => 'GET',
  'uri' => array(
    'host' => '*****',
    'port' => '*****',
    'scheme' => 'http',
    'user' => null,
    'pass' => null,
    'path' => '/rm/types/_lGrbJfq9EeKAc-rpp0B9jg',
    'query' => array(),
    'fragment' => null
   ),
   'version' => '1.1',
   'body' => '',
   'line' => 'GET /rm/types/_lGrbJfq9EeKAc-rpp0B9jg HTTP/1.1',
   'header' => 'Host: SERVERNAME
     Connection: close
     User-Agent: CakePHP
     OSLC-Core-Version: 2.0
     Accept: application/rdf+xml
     Content-Type: application/rdf+xml
     Authorization: OAuth realm="http://SERVERNAME/rm",oauth_consumer_key="49cfd21d97cf4808b730f072c902cef7",oauth_signature_method="HMAC-SHA1",oauth_signature="HjgQTj8a%2BK4VrqmaU3yiFa4rQgQ%3D",oauth_timestamp="1378405866",oauth_nonce="e91dd2cca23f429e6e45a049bb856817",oauth_token="1d45c97961754fa4b4813fd9e756c5e9",oauth_version="1.0"',
  'raw' => 'GET /rm/types/_lGrbJfq9EeKAc-rpp0B9jg HTTP/1.1
    Host: SERVERNAME
    Connection: close
    User-Agent: CakePHP
    OSLC-Core-Version: 2.0
    Accept: application/rdf+xml
    Content-Type: application/rdf+xml
    Authorization: OAuth realm="http://SERVERNAME/rm",oauth_consumer_key="49cfd21d97cf4808b730f072c902cef7",oauth_signature_method="HMAC-SHA1",oauth_signature="HjgQTj8a%2BK4VrqmaU3yiFa4rQgQ%3D",oauth_timestamp="1378405866",oauth_nonce="e91dd2cca23f429e6e45a049bb856817",oauth_token="1d45c97961754fa4b4813fd9e756c5e9",oauth_version="1.0"',
  'redirect' => false,
  'cookies' => array(),
  'proxy' => array(),
  'auth' => array()
)
这不管用

array(
  'method' => 'POST',
  'uri' => array(
    'host' => '*****',
    'port' => '*****',
    'scheme' => 'http',
    'user' => null,
    'pass' => null,
    'path' => '/rm/requirementFactory',
    'query' => array(
      'projectURL' => 'http://SERVERPATH/jts/process/project-areas/_mBD3pfLZEeKeebKxZeYY6w'
    ),
    'fragment' => null
  ),
  'version' => '1.1',
  'body' => '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/terms/"xmlns:public_rm_10="http://www.ibm.com/xmlns/rm/public/1.0/" xmlns:calm="http://jazz.net/xmlns/prod/jazz/calm/1.0/" xmlns:rm="http://www.ibm.com/xmlns/rdm/rdf/"xmlns:acp="http://jazz.net/ns/acp#" xmlns:rm_property="http://SERVERPATH/rm/types/" xmlns:oslc="http://open-services.net/ns/core#" xmlns:nav="http://jazz.net/ns/rm/navigation#" xmlns:oslc_rm="http://open-services.net/ns/rm#"><rdf:Description rdf:about=""><rdf:type rdf:resource="http://open-services.net/ns/rm#Requirement"/><dc:description rdf:parseType="Literal">WPDP Project Document</dc:description><dc:title rdf:parseType="Literal">Mod Test</dc:title><oslc:instanceShape rdf:resource="http://SERVERPATH/rm/types/_lGrbJfq9EeKAc-rpp0B9jg"/></rdf:Description></rdf:RDF>',
  'line' => 'POST /rm/requirementFactory?projectURL=http%3A%2F%2FSERVERPATH%2Fjts%2Fprocess%2Fproject-areas%2F_mBD3pfLZEeKeebKxZeYY6w HTTP/1.1',
  'header' => 'Host: SERVERPATH
    Connection: close
    User-Agent: CakePHP
    OSLC-Core-Version: 2.0
    Accept: application/rdf+xml
    Content-Type: application/rdf+xml
    Authorization: OAuth realm="http://SERVERPATH/rm",oauth_consumer_key="49cfd21d97cf4808b730f072c902cef7",oauth_signature_method="HMAC-SHA1",oauth_signature="CW0FodwyctuRSyDTebrBfsPxAek%3D",oauth_timestamp="1378405206",oauth_nonce="abffa897607dbc1ee2a39aadf19918eb",oauth_token="1d45c97961754fa4b4813fd9e756c5e9",oauth_version="1.0"
    Content-Length: 869',
  'raw' => 'POST /rm/requirementFactory?projectURL=http%3A%2F%2FSERVERPATH%2Fjts%2Fprocess%2Fproject-areas%2F_mBD3pfLZEeKeebKxZeYY6w HTTP/1.1
    Host: SERVERPATH
    Connection: close
    User-Agent: CakePHP
    OSLC-Core-Version: 2.0
    Accept: application/rdf+xml
    Content-Type: application/rdf+xml
    Authorization: OAuth realm="http://SERVERPATH/rm",oauth_consumer_key="49cfd21d97cf4808b730f072c902cef7",oauth_signature_method="HMAC-SHA1",oauth_signature="CW0FodwyctuRSyDTebrBfsPxAek%3D",oauth_timestamp="1378405206",oauth_nonce="abffa897607dbc1ee2a39aadf19918eb",oauth_token="1d45c97961754fa4b4813fd9e756c5e9",oauth_version="1.0"
    Content-Length: 869

    <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/terms/"xmlns:public_rm_10="http://www.ibm.com/xmlns/rm/public/1.0/" xmlns:calm="http://jazz.net/xmlns/prod/jazz/calm/1.0/" xmlns:rm="http://www.ibm.com/xmlns/rdm/rdf/"xmlns:acp="http://jazz.net/ns/acp#" xmlns:rm_property="http://SERVERPATH/rm/types/" xmlns:oslc="http://open-services.net/ns/core#" xmlns:nav="http://jazz.net/ns/rm/navigation#" xmlns:oslc_rm="http://open-services.net/ns/rm#"><rdf:Description rdf:about=""><rdf:type rdf:resource="http://open-services.net/ns/rm#Requirement"/><dc:description rdf:parseType="Literal">WPDP Project Document</dc:description><dc:title rdf:parseType="Literal">Mod Test</dc:title><oslc:instanceShape rdf:resource="http://SERVERPATH/rm/types/_lGrbJfq9EeKAc-rpp0B9jg"/></rdf:Description></rdf:RDF>',
  'redirect' => false,
  'cookies' => array(),
  'proxy' => array(),
  'auth' => array()
)
数组(
'方法'=>'发布',
'uri'=>数组(
“主机”=>“****”,
“端口”=>“****”,
“方案”=>“http”,
'user'=>null,
“通过”=>null,
“路径”=>“/rm/requirementFactory”,
'查询'=>数组(
'项目URL'=>'http://SERVERPATH/jts/process/project-areas/_mBD3pfLZEeKeebKxZeYY6w'
),
'fragment'=>null
),
'版本'=>'1.1',
“正文”=>“WPDP项目文档修改测试”,
“行”=>“POST/rm/requirementFactory?项目URL=http%3A%2F%2FSERVERPATH%2Fjts%2Fprocess%2F项目区域%2F_mbd3pflzeekeebkxzeyyy6w http/1.1”,
'头'=>'主机:服务器路径
连接:关闭
用户代理:CakePHP
OSLC核心版本:2.0
接受:应用程序/rdf+xml
内容类型:应用程序/rdf+xml
授权:OAuth领域=”http://SERVERPATH/rm,oauth_consumer_key=“49cfd21d97cf4808b730f072c902cef7”,oauth_签名方法=“HMAC-SHA1”,oauth_签名=“CW0FodwyctuRSyDTebrBfsPxAek%3D”,oauth_时间戳=“1378405206”,oauth_nonce=“abffa897607dbc1ee2a39aadf19918eb”,oauth_令牌=“1d45c97961754fa4b4813fd9e756c5e9”,oauth_version=“1.0”
内容长度:869',
“原始”=>“POST/rm/requirementFactory?项目URL=http%3A%2F%2FSERVERPATH%2Fjts%2Fprocess%2F项目区域%2F_mBD3pfLZEeKeebKxZeYY6w http/1.1
主机:服务器路径
连接:关闭
用户代理:CakePHP
OSLC核心版本:2.0
接受:应用程序/rdf+xml
内容类型:应用程序/rdf+xml
授权:OAuth领域=”http://SERVERPATH/rm,oauth_consumer_key=“49cfd21d97cf4808b730f072c902cef7”,oauth_签名方法=“HMAC-SHA1”,oauth_签名=“CW0FodwyctuRSyDTebrBfsPxAek%3D”,oauth_时间戳=“1378405206”,oauth_nonce=“abffa897607dbc1ee2a39aadf19918eb”,oauth_令牌=“1d45c97961754fa4b4813fd9e756c5e9”,oauth_version=“1.0”
内容长度:869
WPDP项目文件修改测试',
“重定向”=>false,
'cookies'=>array(),
'proxy'=>array(),
'auth'=>array()
)

我希望如果OAuth令牌或签名无效,我会得到一个错误来解释,这个错误似乎表明OAuth信息完全丢失。

我在IBM的帮助下发现了这个问题

我发送的帖子URL包含projectURL参数。此参数必须从URL中分离出来并包含在基本字符串中,OAuth才能正常工作

另外,
领域
应该是不带参数的完整url,在本例中为
http://SERVERPATH/rm/requirementFactory
http://SERVERPATH/rm

此站点在发现OAuth签名问题时非常有用:

通过单击
+
符号,您可以将自己的变量和令牌信息插入到站点中,并调整输出以显示您的签名和基本字符串应该是什么