<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Call REST API to access a secured NiFi cluster in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Call-REST-API-to-access-a-secured-NiFi-cluster/m-p/345855#M234687</link>
    <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/98623"&gt;@ThongPham&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;There is no such thing as a permanent Bearer token.&amp;nbsp; How long a Bearer token stays valid is set in the provider that issuing that bearer token.&amp;nbsp; In you case the ldap-provider.&amp;nbsp; Also keep in mind that a bearer token is issued by a specific node in the NiFi cluster and can not be used to authenticate with every node in the NiFi cluster.&lt;BR /&gt;&lt;BR /&gt;Since a secured NiFi will always attempt mutual TLS authentication first. I suggest you instead you generate and use a client certificate to interact with the NiFi API.&amp;nbsp; Mutual TLS based authentication does not use bearer tokens and the authentication will be successful until that client certificate expires which is configurable when generating the certificate.&amp;nbsp; But generally speaking certificates are often valid for 12 or months.&amp;nbsp; Since there is no bearer token, a client certificate can be used with any node in the cluster.&lt;BR /&gt;&lt;BR /&gt;Your other option is to build a flow within your NiFi to get a new bearer token automatically and store that token in maybe a distributedMapCache.&amp;nbsp; Then in your other flow you fetch that bearer token before calling the rest-api endpoint.&amp;nbsp; A failure should loop back to the FetchDistrubutedMapCache just in case you have a scenario where the bearer token expires between fetch and call.&lt;BR /&gt;&lt;BR /&gt;Out of curiosity, what rest-api endpoint are you calling every 20 seconds and why?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;If you found this response assisted with your query, please take a moment to login and click on "&lt;STRONG&gt;Accept as Solution&lt;/STRONG&gt;" below this post.&lt;BR /&gt;&lt;BR /&gt;Thank you,&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;</description>
    <pubDate>Fri, 17 Jun 2022 12:56:54 GMT</pubDate>
    <dc:creator>MattWho</dc:creator>
    <dc:date>2022-06-17T12:56:54Z</dc:date>
    <item>
      <title>Call REST API to access a secured NiFi cluster</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Call-REST-API-to-access-a-secured-NiFi-cluster/m-p/345817#M234672</link>
      <description>&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;I build a secured NiFi cluster authenticated by LDAP server.&lt;/P&gt;&lt;P&gt;I am able to use NiFi Rest Api to access the secured cluster via Bearer Token.&lt;BR /&gt;I have build a Nifi flow that need to call */nifi-api/* every 20 seconds and I have a problem is the Token is expire after 8 hours (based on my config) and i have to update&amp;nbsp;Bearer Token manually after 8 hours :((&lt;/P&gt;&lt;P&gt;I was wondering whether some way that I can get a&amp;nbsp;permanet&amp;nbsp;Bearer Token to Call REST API to access a secured NiFi cluster?&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jun 2022 04:49:06 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Call-REST-API-to-access-a-secured-NiFi-cluster/m-p/345817#M234672</guid>
      <dc:creator>ThongPham</dc:creator>
      <dc:date>2022-06-17T04:49:06Z</dc:date>
    </item>
    <item>
      <title>Re: Call REST API to access a secured NiFi cluster</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Call-REST-API-to-access-a-secured-NiFi-cluster/m-p/345855#M234687</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/98623"&gt;@ThongPham&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;There is no such thing as a permanent Bearer token.&amp;nbsp; How long a Bearer token stays valid is set in the provider that issuing that bearer token.&amp;nbsp; In you case the ldap-provider.&amp;nbsp; Also keep in mind that a bearer token is issued by a specific node in the NiFi cluster and can not be used to authenticate with every node in the NiFi cluster.&lt;BR /&gt;&lt;BR /&gt;Since a secured NiFi will always attempt mutual TLS authentication first. I suggest you instead you generate and use a client certificate to interact with the NiFi API.&amp;nbsp; Mutual TLS based authentication does not use bearer tokens and the authentication will be successful until that client certificate expires which is configurable when generating the certificate.&amp;nbsp; But generally speaking certificates are often valid for 12 or months.&amp;nbsp; Since there is no bearer token, a client certificate can be used with any node in the cluster.&lt;BR /&gt;&lt;BR /&gt;Your other option is to build a flow within your NiFi to get a new bearer token automatically and store that token in maybe a distributedMapCache.&amp;nbsp; Then in your other flow you fetch that bearer token before calling the rest-api endpoint.&amp;nbsp; A failure should loop back to the FetchDistrubutedMapCache just in case you have a scenario where the bearer token expires between fetch and call.&lt;BR /&gt;&lt;BR /&gt;Out of curiosity, what rest-api endpoint are you calling every 20 seconds and why?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;If you found this response assisted with your query, please take a moment to login and click on "&lt;STRONG&gt;Accept as Solution&lt;/STRONG&gt;" below this post.&lt;BR /&gt;&lt;BR /&gt;Thank you,&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jun 2022 12:56:54 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Call-REST-API-to-access-a-secured-NiFi-cluster/m-p/345855#M234687</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2022-06-17T12:56:54Z</dc:date>
    </item>
    <item>
      <title>Re: Call REST API to access a secured NiFi cluster</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Call-REST-API-to-access-a-secured-NiFi-cluster/m-p/345895#M234697</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/35454"&gt;@MattWho&lt;/a&gt;&amp;nbsp;, i have build almost 20 Processor Groups, and i want to know which one has ERROR processor during running those. So i build a flow that call API */processor-group to get &lt;STRONG&gt;bulletin&amp;nbsp;&lt;/STRONG&gt;for each group, so that if some group has ERROR processor, they will PutEmail to me know which group failed.&lt;BR /&gt;Detail of my flow is: Cluster 3 nodes (a, b, c) call API processor-group to Node a every 5 mins (i just update from 20 sec to 5 mins) to PutEmail where a processor ERROR. Is there anyother way to do that ?&lt;BR /&gt;Thank you for your above solution!&lt;/P&gt;</description>
      <pubDate>Sun, 19 Jun 2022 10:49:47 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Call-REST-API-to-access-a-secured-NiFi-cluster/m-p/345895#M234697</guid>
      <dc:creator>ThongPham</dc:creator>
      <dc:date>2022-06-19T10:49:47Z</dc:date>
    </item>
    <item>
      <title>Re: Call REST API to access a secured NiFi cluster</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Call-REST-API-to-access-a-secured-NiFi-cluster/m-p/346067#M234736</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/98623"&gt;@ThongPham&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sounds like you may making a lot of unnecessary rest-api calls that could impact your NiFi's overall performance.&amp;nbsp; &amp;nbsp;Have you maybe looked at using the &lt;A href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-site-to-site-reporting-nar/1.16.2/org.apache.nifi.reporting.SiteToSiteBulletinReportingTask/index.html" target="_self"&gt;SiteToSiteBulletingReportingTask&lt;/A&gt;?&lt;BR /&gt;&lt;BR /&gt;This reporting task will send a FlowFile to a remote input port upon execution of bulletin(s) are produced.&amp;nbsp; That Remote Input Port could then be built into a dataflow that makes notifications via putEmail.&amp;nbsp; So instead of constantly calling the rest-api to see if something happened in the last 5 minutes, the flow will simply send something out when it happens only.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you found this response assisted with your query, please take a moment to login and click on "&lt;STRONG&gt;Accept as Solution&lt;/STRONG&gt;" below this post.&lt;BR /&gt;&lt;BR /&gt;Thank you,&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2022 15:04:07 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Call-REST-API-to-access-a-secured-NiFi-cluster/m-p/346067#M234736</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2022-06-21T15:04:07Z</dc:date>
    </item>
  </channel>
</rss>

