簡體   English   中英

無法對Fiware Lab KeyRock實例中的應用程序的用戶進行身份驗證

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

我已經在Keyrock中注冊了兩個用戶(全球Fiware Labs實例位於https://account.lab.fiware.org

  • 用戶Robin具有一個組織Robin-Cloud
  • 用戶Robin是應用程序Babbler的所有者
  • Babbler應用程序已授權用戶“ Robin”和“ Robin Viewer”(請參見屏幕截圖)
  • 用戶“ Robin查看器”與用戶“ Robin”是同一組織的成員
  • 只是為了確保我授權了“ Robin查看器”所屬的整個組織。
  • 兩個用戶具有相同的角色。

Keyrock中的應用程序定義

我可以使用Shell腳本對用戶“ Robin”進行身份驗證以獲取訪問令牌。 在shell腳本中,我傳入了Applications Client ID和Client secret。 我還傳遞了“ Robin”用戶的用戶名和密碼。 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

然而

我無法獲得用戶“ Robin Viewer”的訪問令牌。 我從Keyrock收到的消息是:

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

我假設在Keyrock用戶界面中為Babbler應用程序授權用戶“ Robin查看器”就足夠了。 我在這里想念什么?

似乎/oauth2/token?grant_type=password組合僅適用於資源所有者,這正是我所看到的。

因此,似乎我們僅限於使用以下請求請求訪問令牌: /oauth2/authorize?response_type=token&client_id=....&redirect_uri=....

這迫使我們通過Horizo​​n前端的Web登錄屏幕。 我們正在從智能手機開始登錄流程,因此這並不是理想的選擇,因為Horizo​​n屏幕根本沒有響應:(

[編輯]

該錯誤似乎是由於電子郵件地址中未編碼的特殊字符造成的(我們有一個加號,因為gmail會忽略加號后的所有內容,從而使我們可以創建多個電子郵件地址,並仍通過真實的電子郵件地址接收它們:例如,用戶名+test@gmail.com到達username@gmail.com)。

因此,我們的問題似乎已經消失了(或者全球固件實例上的最新Keyrock更新為我們解決了這個問題?)。 現在我們可以使用/ oauth2 / token?grant_type = password了。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM