2017-03-16 75 views
1

我已經爲Apache NiFi-1.1.1啓用LDAP身份驗證。如何將證書傳遞給NiFi休息API

我能夠訪問NiFi Web UI的登錄與LDAP用戶後。

當我試着使用基本身份驗證/process-groups/root訪問REST API,它顯示

Unable to perform the desired action due to insufficient permissions. Contact the system administrator.

如何通過證書來NiFi REST API? 如何使用令牌訪問NiFi REST API?

在此先感謝。

回答

4

當經由LDAP認證,則NiFi REST API將需要沿着與每個請求令牌,客戶端通。要獲得令牌,您需要傳遞憑據以進行身份​​驗證。

curl 'https://localhost:8443/nifi-api/access/token' -H 'Accept-Encoding: gzip, deflate, br' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'Accept: */*' --data 'username=<user>&password=<pass>' --compressed 

該請求將返回您需要在每個後續請求的標頭中傳遞的令牌。例如:

curl 'https://localhost:8443/nifi-api/flow/current-user' -H 'Accept-Encoding: gzip, deflate, sdch, br' -H 'Authorization: Bearer <token>' -H 'Accept: application/json, text/javascript, */*; q=0.01' --compressed