You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "Romain Guay (JIRA)" <ji...@apache.org> on 2018/08/07 17:59:00 UTC

[jira] [Commented] (NIFI-4246) OAuth 2 Authorization support - Client Credentials Grant

    [ https://issues.apache.org/jira/browse/NIFI-4246?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16572049#comment-16572049 ] 

Romain Guay commented on NIFI-4246:
-----------------------------------

Hi all and thanks for this useful work.

I am new to this conversation and relatively new to Nifi, but I have of course the need to OAuth authentication, and I also have a similar need with a custom token-based authentication which I think is not so different. I wonder if we could take this opportunity to open our options by defining a slightly more genetic interface for this authentication service and allow multiple implementations for the same InvokeHttp processor.

Here is what I would suggest:
{noformat}
public interface AuthenticationProviderClientService extends ControllerService {
 boolean isTokenExpired();
 boolean isTokenExpired(int statusCode, String message);
 Map<String, String> getAuthenticationHeaders();
 boolean authenticate(); 
}{noformat}
The isTokenExpired() method is used as currently when preparing the request. The isTokenExpired(String response) method would be used in cases where the token does not know its expiration, but we can determine it from the statusCode and message from the HTTP response. If it is expired, authenticate() is called and the flow file sent to retry. So each implementation would use either one or the other, returning false by default.

I also think having getAuthenticationHeaders() instead of getAccessToken() makes it more generic.

Please let me know if this all makes sense.

 

> OAuth 2 Authorization support - Client Credentials Grant
> --------------------------------------------------------
>
>                 Key: NIFI-4246
>                 URL: https://issues.apache.org/jira/browse/NIFI-4246
>             Project: Apache NiFi
>          Issue Type: Improvement
>            Reporter: Jeremy Dyer
>            Assignee: Jeremy Dyer
>            Priority: Major
>
> If your interacting with REST endpoints on the web chances are you are going to run into an OAuth2 secured webservice. The IETF (Internet Engineering Task Force) defines 4 methods in which OAuth2 authorization can occur. This JIRA is focused solely on the Client Credentials Grant method defined at https://tools.ietf.org/html/rfc6749#section-4.4
> This implementation should provide a ControllerService in which the enduser can configure the credentials for obtaining the authorization grant (access token) from the resource owner. In turn a new property will be added to the InvokeHTTP processor (if it doesn't already exist from one of the other JIRA efforts similar to this one) where the processor can reference this controller service to obtain the access token and insert the appropriate HTTP header (Authorization: Bearer{access_token}) so that the InvokeHTTP processor can interact with the OAuth protected resources without having to worry about setting up the credentials for each InvokeHTTP processor saving time and complexity.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)