@ravi_tadepally
The NiFi CLI toolkit currently only supports authentication with client certificate, client certificate with proxied user identity or basic auth (via basic auth token). There is no option to obtain a token via OIDC authentication method.
Using token based authentication to perform other NiFi Toolkit CLI commands is probably not the best approach. Tokens have limited life, are only valid fro use interacting with the specific NiFi instance from which it was issued.
The better approach would be to create a cli-nifi.properties file with a proxied entity (this would be your OIDC user identity):
baseUrl=https://<nifi-hostname>:<NiFi-port>
keystore=/path/to/<nifi-keystore.jks>
keystoreType=JKS
keystorePasswd=<nifi-keystore-password>
keyPasswd=<nifi-key-password>
truststore=/path/to/truststore.jks
truststoreType=JKS
truststorePasswd=<nifi-truststore-password>
proxiedEntity=<OIDC username>
In a NIfI cluster, the NiFi keystore certificate should already be authorized to "proxy user requests". The "-p cli-nifi.properties" option in NiFi Cli toolkit will utilize the config file above to authenticate via the NiFi node certificate and then make authorized request on behalf of the proxied entity. So, no need to directly authenticate and obtain a token for that proxied entity.
example:
./cli.sh nifi cluster-summary -p cli-nifi.properties
would return following provided the proxied entity is authorized for that endpoint data:
Total node count: 3
Connected node count: 3
Clustered: true
Connected to cluster: true
If you found that the provided solution(s) assisted you with your query, please take a moment to login and click Accept as Solution below each response that helped.
Thank you,
Matt