简体   繁体   English

在Fiware AuthZforce授权服务器中创建域时遇到问题

[英]Problems creating a domain in Fiware AuthZforce Authorization Server

I'm developing an authentication/authorization scheme, based on Oauth 2.0, using the Fiware Enablers: Keyrock IdM, Wilma Proxy and AuthZforce authorizaton server. 我正在使用Fiware Enabler开发基于Oauth 2.0的身份验证/授权方案:Keyrock IdM,Wilma Proxy和AuthZforce授权服务器。

I installed and configured Keyrock and Wilma and they work fine together. 我安装并配置了Keyrock和Wilma,并且它们可以一起正常工作。

On the same machine I installed AuthZForce. 在同一台计算机上,我安装了AuthZForce。 Java OpenJDK 1.7.0_91 and Tomcat 7 are installed on Ubuntu 14.04 on this machine. Java OpenJDK 1.7.0_91和Tomcat 7安装在此计算机上的Ubuntu 14.04上。

I followed the installation guide and installed AuthZforce with gdebi, but I can't actually create a domain with the curl command found in the guide: 我遵循了安装指南,并使用gdebi安装了AuthZforce,但实际上无法使用指南中的curl命令创建域:

curl --verbose --trace-ascii - --request POST \\ --header "Content-Type: application/xml;charset=UTF-8" --data '<?xml version="1.0" encoding="UTF-8"?><taz:domainProperties xmlns:taz="http://authzforce.github.io/rest-api-model/xmlns/authz/4"> <name>MyDomain</name><description>This is my domain.</description></taz:domainProperties>' --header "Accept: application/xml" http://${MYSERVERHOST}:${MYPORT}/authzforce-ce/domains curl --verbose --trace-ascii--请求POST \\ --header“内容类型:application / xml; charset = UTF-8” --data'<?xml version =“ 1.0” encoding =“ UTF- 8“?> <taz:domainProperties xmlns:taz =” http://authzforce.github.io/rest-api-model/xmlns/authz/4“> <name> MyDomain </ name> <description>这是我的域。</ description> </ taz:domainProperties>'--header“ Accept:application / xml” http:// $ {MYSERVERHOST}:$ {MYPORT} / authzforce-ce / domains

I got the following error: 我收到以下错误:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><ns2:error xmlns:ns2="http://authzforce.github.io/rest-api-model/xmlns/authz/4" xmlns:ns3="http://www.w3.org/2005/Atom" xmlns:ns4="http://authzforce.github.io/core/xmlns/pdp/3.6" xmlns:ns5="http://authzforce.github.io/pap-dao-file/xmlns/properties/3.6"><message>Invalid parameters: cvc-complex-type.2.4.a: Invalid content starting with "name". <?xml version =“ 1.0” encoding =“ UTF-8” standalone =“ yes”?> <ns2:error xmlns:ns2 =“ http://authzforce.github.io/rest-api-model/xmlns/authz / 4“ xmlns:ns3 =” http://www.w3.org/2005/Atom“ xmlns:ns4 =” http://authzforce.github.io/core/xmlns/pdp/3.6“ xmlns:ns5 =” http://authzforce.github.io/pap-dao-file/xmlns/properties/3.6“> <消息>无效参数:cvc-complex-type.2.4.a:无效的内容以“名称”开头。 Invalid content was found starting with element "name". 发现了以元素“名称”开头的无效内容。 An element "{description, rootPolicyRef}" is expected.</message></ns2:error> 预期元素“ {description,rootPolicyRef}”。</ message> </ ns2:error>

It seems to be an xml validation error. 看来是xml验证错误。 I tried to access the AuthZforce API but the link in the the programmer's guide gives a 404 error. 我尝试访问AuthZforce API,但程序员指南中的链接给出了404错误。

Can anyone suggest how to fix this issue? 谁能建议如何解决此问题?

Thanks in advance. 提前致谢。 ~

I realized my initial answer was rejected, so I'll try to provide a better one. 我意识到我的最初答案被拒绝了,所以我将尝试提供一个更好的答案。 In the meantime, new AuthzForce releases have come out, so I give you here a working example for the latest AuthzForce v5.4.1. 同时,新的AuthzForce版本已经发布,因此我在这里为您提供最新AuthzForce v5.4.1的有效示例。 (Please upgrade if necessary.) For simplicity, let's write the XML payload into a file domainProperties.xml and reuse it in the curl command: (如果需要,请升级。)为简单起见,让我们将XML有效负载写入文件domainProperties.xml ,并在curl命令中重新使用它:

$ cat domainProperties.xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<domainProperties xmlns="http://authzforce.github.io/rest-api-model/xmlns/authz/5" externalId="myOwnId">
   <description>This is my domain</description>
</domainProperties>

The externalId is optional and you can set it to any alias you want to use to use for the new domain. externalId是可选的,您可以将其设置为要用于新域的任何别名。

The curl command goes: curl命令运行:

$ curl --verbose --request "POST" --header "Content-Type: application/xml;charset=UTF-8" --data @domainProperties.xml --header "Accept: application/xml" http://localhost:8080/authzforce-ce/domains

Replace localhost if your hostname and 8080 with the server port if necessary. 如果您的主机名替换localhost则在必要时将8080替换为服务器端口。 The response should give a link to the new domain resource with the new domain ID: 该响应应提供一个指向具有新域ID的新域资源的链接:

...
< HTTP/1.1 200 OK
< Server: Authorization System
< Date: Mon, 04 Aug 2016 13:00:12 GMT
< Content-Type: application/xml
< Transfer-Encoding: chunked
<
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<link xmlns="http://www.w3.org/2005/Atom" rel="item" href="h_D23LsDEeWFwqVFFMDLTQ" title="h_D23LsDEeWFwqVFFMDLTQ"/>

More info in the installation guide . 安装指南中的更多信息。

You can also use the externalId to get back the domain info: 您还可以使用externalId来获取域信息:

$ curl --verbose --request "GET" --header "Accept: application/xml" http://localhost:8080/authzforce-ce/domains?externalId=myOwnId 

More info in the user guide . 用户指南中的更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM