You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@nifi.apache.org by Chris Herrera <ch...@gmail.com> on 2018/01/03 19:44:50 UTC

Nifi REST API access to OpenID connect secured instance

Hi All,

We have a Nifi 1.4.0 instance secured with OpenID connect via Azure AD. I was wondering how to access the REST API via curl. Essentially we need to access the bearer token, which we received from Azure AD, but then we receive theĀ unable to validate the access token error. Any insights would be very helpful.

Thanks!
Chris

Re: Nifi REST API access to OpenID connect secured instance

Posted by Bryan Bende <bb...@gmail.com>.
Chris,

I only have a high-level understanding of how OIDC authentication
works, and I am not exactly sure how to simulate this via curl, but
here is what I think is happening...

There are three REST end-points in NiFi...

- /access/oidc/request
- /access/oidc/callback
- /access/oidc/exchange

During a request that needs to be authenticated, one of NiFi's servlet
filters detects that NiFi was configured with OIDC and redirects to
/access/oidc/request.

/access/oidc/request creates a cookie with an identifier for the
request, and then redirects to the URL of the OIDC provider, passing
along the callback URL in NiFi that the provider should invoke, which
should be /access/oidc/callback.

After entering credentials into the provider's login page,
/access/oidc/callback is invoked... if the provider said everything
was good then it exchanges the grant from the provider for a NiFi JWT,
and caches the JWT using the request identifier from the cookie, then
redirects to /nifi.

By redirecting to /nifi, the UI now goes through its normal checks,
one of them is attempting to call /access/oidc/exchange which will get
the JWT based on the request identifier in the cookie, and put the JWT
into the browser's local storage.

I know that doesn't really answer your exact question, but maybe helps
you think about how to automate it with curl.

Alternatively, you can always use a client certificate even when OIDC
is configured to avoid needing tokens, or if you have logged in via
your browser you can find the JWT in the local storage of your browser
(Chrome Dev tools under Application then Storage) and use that same
token on your curl requests.

Thanks,

Bryan


On Wed, Jan 3, 2018 at 2:44 PM, Chris Herrera <ch...@gmail.com> wrote:
> Hi All,
>
> We have a Nifi 1.4.0 instance secured with OpenID connect via Azure AD. I
> was wondering how to access the REST API via curl. Essentially we need to
> access the bearer token, which we received from Azure AD, but then we
> receive the unable to validate the access token error. Any insights would be
> very helpful.
>
> Thanks!
> Chris