简体   繁体   English

无法对Fiware Lab KeyRock实例中的应用程序的用户进行身份验证

[英]Unable to authenticate users for an app in Fiware Lab KeyRock instance

I have registered two users in Keyrock (the global fiware labs instance at https://account.lab.fiware.org ) 我已经在Keyrock中注册了两个用户(全球Fiware Labs实例位于https://account.lab.fiware.org

  • User Robin has an organisation Robin-Cloud 用户Robin具有一个组织Robin-Cloud
  • User Robin is owner of an application Babbler 用户Robin是应用程序Babbler的所有者
  • The application Babbler has authorized users "Robin" and "Robin viewer" (see screenshot) Babbler应用程序已授权用户“ Robin”和“ Robin Viewer”(请参见屏幕截图)
  • User "Robin viewer" is a member of the same organisation as user "Robin" 用户“ Robin查看器”与用户“ Robin”是同一组织的成员
  • Just to be sure i authorized the whole organisation that "Robin viewer" belongs to. 只是为了确保我授权了“ Robin查看器”所属的整个组织。
  • Both users have the same roles. 两个用户具有相同的角色。

Keyrock中的应用程序定义

I can authenticate user "Robin" using a shell script to get an Access token. 我可以使用Shell脚本对用户“ Robin”进行身份验证以获取访问令牌。 In the shell script i pass in the Applications Client ID and Client secret. 在shell脚本中,我传入了Applications Client ID和Client secret。 I also pass in the username and password of User "Robin". 我还传递了“ Robin”用户的用户名和密码。 The shell script is here (altered copy of this https://raw.githubusercontent.com/Bitergia/fiware-chanchan-docker/master/images/pep-wilma/4.3.0/auth-token.sh ): shell脚本在此处(此https://raw.githubusercontent.com/Bitergia/fiware-chanchan-docker/master/images/pep-wilma/4.3.0/auth-token.sh的更改副本):

#!/bin/bash

if [ $# -lt 2 ] ; then
    echo "auth-token: missing parameters."
    echo "Usage: auth-token <user-email> <password>"
    exit 1
fi

# Retrieve X-Auth-Token to make request against the protected resource

function get_token () {

    if [ $# -lt 2 ] ; then
    echo "get_token: missing parameters."
    echo "Usage: get_token <user-email> <password>"
    exit 1
    fi

    local _user=$1
    local _pass=$2

    # Retrieve Client ID and client Secret Automatically

    CLIENT_ID="e2c095aa42414e75b9ac4d760f4c625a"
    CLIENT_SECRET="****"

    # Generate the Authentication Header for the request

    AUTH_HEADER="$(echo -n ${CLIENT_ID}:${CLIENT_SECRET} | base64)"

    # Define headers

    CONTENT_TYPE="\"Content-Type: application/x-www-form-urlencoded\""
    AUTH_BASIC="\"Authorization: Basic ${AUTH_HEADER}\""

    # Define data to send

    DATA="'grant_type=password&username=${_user}&password=${_pass}&client_id=${CLIENT_ID}&client_secret=${CLIENT_SECRET}'"

    # Create the request

    REQUEST="curl -s --insecure -i --header ${AUTH_BASIC} --header ${CONTENT_TYPE} -X POST https://account.lab.fiware.org/oauth2/token -d ${DATA}"
    XAUTH_TOKEN="$(eval ${REQUEST})"
    echo "Request: ${REQUEST}"
    echo "X-Auth-Token for '${_user}': ${XAUTH_TOKEN}"

}

get_token $1 $2

However 然而

I cannot get an access token for User "Robin viewer". 我无法获得用户“ Robin Viewer”的访问令牌。 The message i get from Keyrock is: 我从Keyrock收到的消息是:

{"error": {"message": "The request you have made requires authentication.", "code": 401, "title": "Unauthorized"}}

I assumed authorizing user "Robin viewer" for the Babbler app in the Keyrock user interface would be enough. 我假设在Keyrock用户界面中为Babbler应用程序授权用户“ Robin查看器”就足够了。 What am i missing here? 我在这里想念什么?

It seems the /oauth2/token?grant_type=password combination is only meant for resource owners, which is exactly what i am seeing. 似乎/oauth2/token?grant_type=password组合仅适用于资源所有者,这正是我所看到的。

So it seems we are limited to requesting an access token with this: /oauth2/authorize?response_type=token&client_id=....&redirect_uri=.... 因此,似乎我们仅限于使用以下请求请求访问令牌: /oauth2/authorize?response_type=token&client_id=....&redirect_uri=....

Which forces us through the web login screen of the Horizon Front-End. 这迫使我们通过Horizo​​n前端的Web登录屏幕。 We are starting the login flow from a smartphone so this is far from ideal because the Horizon screens are NOT responsive at all :( 我们正在从智能手机开始登录流程,因此这并不是理想的选择,因为Horizo​​n屏幕根本没有响应:(

[Edit] [编辑]

The error seems to be due to special characters in the email address that were not encoded (we have a plus sign because gmail ignores anything after the plus, allowing us to create multiple email addresses and still receive them at a real email address: eg username+test@gmail.com arrives at username@gmail.com). 该错误似乎是由于电子邮件地址中未编码的特殊字符造成的(我们有一个加号,因为gmail会忽略加号后的所有内容,从而使我们可以创建多个电子邮件地址,并仍通过真实的电子邮件地址接收它们:例如,用户名+test@gmail.com到达username@gmail.com)。

So our problem seems to have gone away (or maybe the latest Keyrock update on the global fiware instance solved it for us?). 因此,我们的问题似乎已经消失了(或者全球固件实例上的最新Keyrock更新为我们解决了这个问题?)。 We can now use /oauth2/token?grant_type=password after all. 现在我们可以使用/ oauth2 / token?grant_type = password了。

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

相关问题 如何在Keyrock FIWARE中配置X-AUTH-TOKEN - How can I configure the X-AUTH-TOKEN in the keyrock FIWARE 验证外部应用到Salesforce实例 - Authenticate External App to Salesforce instance 如何在Java(REST)应用程序中验证用户? - How to authenticate users in Java(REST) app? 在不注册应用的情况下通过 Microsoft 对用户进行身份验证 - Authenticate users with Microsoft without registering an app Android 消费webservice的APP如何认证用户 - Android APP that consumes a webservice how to authenticate users 如何为我的Android应用验证用户身份? - How do I authenticate users for my Android app? 了解如何从Android向Rails应用验证用户 - Understanding how to authenticate users from Android to Rails app 如何为iPhone应用程序在CMS上对用户进行身份验证? - How can I authenticate users on a CMS for an iphone app? Firebase安全规则,如何对客户端应用而非用户进行身份验证? - Firebase security rules, How to authenticate client app, not the users? 有没有办法在我的 ionic 应用程序中使用 instagram 对用户进行身份验证? - Is there any way to authenticate users with instagram in my ionic app?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM