【发布时间】:2017-07-11 20:02:19
【问题描述】:
我们又来了另一个问题。
我意识到我的问题很模糊,但我的知识很模糊。这种九头蛇太大而且开得太大,当你知道如何使用它时很好,但当你不知道如何使用它时,天哪。如果你还没有弄清楚我不是网络人。
我目前正在尝试仅将 WSO2IS 用作授权管理器。
每次访问网站的用户都必须登录(我知道这违背了它的全部目的),但这就是我收到的卡片。
这是我需要的流程。
1.用户去https://wso2-dev.h3net.com/hello_world.php
一个。登录请求
1. 用户名
2.密码
3. company_id
湾。创建 curl(curl 库)以发送登录时收集的 3 个项目
1. 需要正确的 URL 以确保正确的 API 安全性
C。收到 TRUE/FALSE(或某些指示)认证被授予
2. wso2is
一个。 hello_world.php 已在 wso2is 注册
湾。用户已创建
C。角色已创建
d。已为角色设置权限
e.复制 PAP authn_user_claim_based_policy_template,更改为名称和声明用户名,company_id(使用 externalid)
F。 TryIt 不起作用,找不到足以告诉我需要填写什么的文档。
G。发布到 PDP
我对使用哪个 URL 和哪种格式来获得授权感到非常困惑?
下面我尝试使用 XACML,相当冗长,但我会接受任何我可以工作的东西。
<?php
print "<html><body>";
print "<p>authorize</p>";
$url = "https://wso2-dev.h3net.com:9443/samlsso";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_VERBOSE , true ); # duplicates -v
curl_setopt($ch, CURLOPT_RETURNTRANSFER , true );
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER , false ); # duplicates -k
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST , false ); # duplicates -k
curl_setopt($ch, CURLOPT_POSTFIELDS ,
'<Request xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" CombinedDecision="false" ReturnPolicyIdList="false">
<Attributes Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource">
<Attribute AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id" IncludeInResult="false">
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">username</AttributeValue>
</Attribute>
</Attributes>
<Attributes Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject">
<Attribute AttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id" IncludeInResult="false">
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">gadams</AttributeValue>
</Attribute>
</Attributes>
<Attributes Category="urn:oasis:names:tc:xacml:3.0:attribute-category:action">
<Attribute AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id" IncludeInResult="false">
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">authorize</AttributeValue>
</Attribute>
</Attributes>
</Request> ');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: text/xml"));
$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
} else {
print "<p>result = $result</p>\n";
}
curl_close ($ch);
}
print "</body></html>\n";
?>
【问题讨论】:
标签: authentication curl wso2is xacml