无法通过ckanext-oauth2插件使用WSO2 IDM对CKAN进行身份验证

时间:2018-07-23 11:45:24

标签: oauth-2.0 wso2 wso2is fiware ckan

我正在使用CKAN 2.7.2。

我在ckan的development.ini文件中添加了以下配置:

GWMI Win32_Process -F "Name='frmweb.exe'"|Select Name,CommandLine|Export-CSV -U -NoT .\commandline.txt

此外,使用粘贴服务运行ckan时已导出以下内容:

ckan.oauth2.authorization_endpoint = https://wso2IP/oauth2/authorize
ckan.oauth2.token_endpoint = https://wso2IP/oauth2/token
ckan.oauth2.profile_api_url = https://wso2IP/userinfo
ckan.oauth2.client_id = *client-id*
ckan.oauth2.client_secret = *clientsecret*
ckan.oauth2.profile_api_user_field = abc
ckan.oauth2.profile_api_mail_field = abc@gmail.com

此外,我还在WSO2 Identity Server中添加了具有回调URL =(http://ckan-url:5000/oauth2/callback)的应用程序(ckan提供程序),其中正在运行CKAN实例(即在其上运行的172.30.66.XX类型的私有IP)端口5000)。

那么,需要在WSO2 Identity Server和ckan development.ini文件中进行哪些配置?

此外,在两面都进行配置时,我在CKAN GUI中收到错误 客户端身份验证失败


我正在使用Ckan 2.7.2,WSO2-IS 5.1和ckanext-oauth2(oauthlib == 0.8.0)v0.6.0

在身份验证过程中会出现问题吗?可能是版本依赖性问题吗?

我已经遵循了给定的步骤。如果我缺少或做错了事,请正确纠正:

我已经使用了API存储并发布了ckan应用程序。

输入ckan回调网址为http:// oauth2 / callback

在ckan配置中输入了从第1步生成的客户端ID和客户端密钥。

还进行了您提到的有关声明配置和ckanext-oauth2配置的给定更改。

现在,它给出上述错误。或者有时客户端无效(客户端身份验证失败)

入站设置:

在此处输入图片描述

enter image description here

enter image description here

enter image description here

enter image description here

错误日志:

export OAUTHLIB_INSECURE_TRANSPORT=True

配置设置后,我收到以下消息:

enter image description here

1 个答案:

答案 0 :(得分:1)

您在WSO2-IS上的应用程序设置似乎正确。唯一要考虑的是,ckanext-oauth2仅能使用CodeRefresh Token授予类型,因此只需要允许这些类型。

ckanext-oauth2使用此配置:

ckan.oauth2.authorization_endpoint = https://wso2IP/oauth2/authorize
ckan.oauth2.token_endpoint = https://wso2IP/oauth2/token
ckan.oauth2.profile_api_url = https://wso2IP/userinfo
ckan.oauth2.client_id = *** OAuth Client Key from the Inbound Authentication Configuration at WSO2 ***
ckan.oauth2.client_secret = *** OAuth Client Secret from the Inbound Authentication Configuration at WSO2 ***
ckan.oauth2.scope = all_info openid
ckan.oauth2.profile_api_user_field = email
ckan.oauth2.profile_api_fullname_field = name
ckan.oauth2.profile_api_mail_field = email

并使用您的声明映射配置(http://wso2.org/claims/fullnamehttp://wso2.org/claims/emailaddress);我能够登录CKAN。我已经使用CKAN v2.7.4,v2.8.0和v2.8.1进行了测试; ckanext-oauth2 v0.6.1和WSO2-IS v5.5.0(尽管它应该可以在WSO2-IS v5.1中使用)。