如何将凭据传递给NiFi REST API [英] How to pass credential to NiFi rest api

查看:17
本文介绍了如何将凭据传递给NiFi REST API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已为Apache NiFi-1.1.1启用了LDAP身份验证。

我可以在使用ldap用户登录后访问NiFi Web用户界面。

当我尝试使用基本身份验证访问REST API/process-groups/root时,显示

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

  • 如何将凭据传递给NiFi REST API?
  • 如何使用令牌访问NiFi REST API?

推荐答案

通过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

这篇关于如何将凭据传递给NiFi REST API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆