You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by sbouchex <gi...@git.apache.org> on 2018/03/27 13:14:12 UTC

[GitHub] nifi pull request #2585: NIFI-5019 - Added HTTP 'basic' authentication to Li...

GitHub user sbouchex opened a pull request:

    https://github.com/apache/nifi/pull/2585

    NIFI-5019 - Added HTTP 'basic' authentication to ListenHTTP processor

    Thank you for submitting a contribution to Apache NiFi.
    
    In order to streamline the review of the contribution we ask you
    to ensure the following steps have been taken:
    
    ### For all changes:
    - [x ] Is there a JIRA ticket associated with this PR? Is it referenced 
         in the commit message?
    
    - [x ] Does your PR title start with NIFI-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
    
    - [ x] Has your PR been rebased against the latest commit within the target branch (typically master)?
    
    - [x ] Is your initial contribution a single, squashed commit?
    
    ### For code changes:
    - [x ] Have you ensured that the full suite of tests is executed via mvn -Pcontrib-check clean install at the root nifi folder?
    - [x ] Have you written or updated unit tests to verify your changes?
    - [x ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? 
    - [x ] If applicable, have you updated the LICENSE file, including the main LICENSE file under nifi-assembly?
    - [x ] If applicable, have you updated the NOTICE file, including the main NOTICE file found under nifi-assembly?
    - [x ] If adding new Properties, have you added .displayName in addition to .name (programmatic access) for each of the new properties?
    
    ### For documentation related changes:
    - [ x] Have you ensured that format looks appropriate for the output in which it is rendered?
    
    ### Note:
    Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/infovista/nifi http_authentication

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/nifi/pull/2585.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #2585
    
----
commit ee37f81bc6979a32450b0746f9e62437b76168cc
Author: sbouchex <sb...@...>
Date:   2018-03-27T13:10:09Z

    Added HTTP 'basic' authentication to ListenHTTP processor

----


---

[GitHub] nifi issue #2585: NIFI-5019 - Added HTTP 'basic' authentication to ListenHTT...

Posted by sbouchex <gi...@git.apache.org>.
Github user sbouchex commented on the issue:

    https://github.com/apache/nifi/pull/2585
  
    @zenfenan the contril-check rat.txt file reports issues on the nifi-grpc-processors which has not been touched by my changes. Are you speaking of them or a different one ?


---

[GitHub] nifi pull request #2585: NIFI-5019 - Added HTTP 'basic' authentication to Li...

Posted by sbouchex <gi...@git.apache.org>.
Github user sbouchex commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2585#discussion_r177522065
  
    --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ListenHTTP.java ---
    @@ -213,6 +260,8 @@ private void createHttpServerFromService(final ProcessContext context) throws Ex
             final Double maxBytesPerSecond = context.getProperty(MAX_DATA_RATE).asDataSize(DataUnit.B);
             final StreamThrottler streamThrottler = (maxBytesPerSecond == null) ? null : new LeakyBucketStreamThrottler(maxBytesPerSecond.intValue());
             final int returnCode = context.getProperty(RETURN_CODE).asInteger();
    +        final String authenticationUsername = trimToEmpty(context.getProperty(PROP_BASIC_AUTH_USERNAME).evaluateAttributeExpressions().getValue());
    +        final String authenticationPassword = trimToEmpty(context.getProperty(PROP_BASIC_AUTH_PASSWORD).evaluateAttributeExpressions().getValue());
    --- End diff --
    
    trimToEmpty is taking take of remplacing null by ""
    
    Regarding the SSLcontext, you are partially right as the authentication should be allowed in both mode (because some devices do not allow HTTPS sometimes for performance reasons)


---

[GitHub] nifi issue #2585: NIFI-5019 - Added HTTP 'basic' authentication to ListenHTT...

Posted by zenfenan <gi...@git.apache.org>.
Github user zenfenan commented on the issue:

    https://github.com/apache/nifi/pull/2585
  
    @sbouchex The project has checkstyle configuration which is checked/enabled when you build with the `contrib-check` Maven profile. The nifi-grpc-processors has some problem in getting built with the complete project. You can do this first `mvn clean -Pinclude-grpc` and then run `mvn
    -Pcontrib-check install`


---

[GitHub] nifi pull request #2585: NIFI-5019 - Added HTTP 'basic' authentication to Li...

Posted by sbouchex <gi...@git.apache.org>.
Github user sbouchex commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2585#discussion_r177528070
  
    --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ListenHTTP.java ---
    @@ -213,6 +260,8 @@ private void createHttpServerFromService(final ProcessContext context) throws Ex
             final Double maxBytesPerSecond = context.getProperty(MAX_DATA_RATE).asDataSize(DataUnit.B);
             final StreamThrottler streamThrottler = (maxBytesPerSecond == null) ? null : new LeakyBucketStreamThrottler(maxBytesPerSecond.intValue());
             final int returnCode = context.getProperty(RETURN_CODE).asInteger();
    +        final String authenticationUsername = trimToEmpty(context.getProperty(PROP_BASIC_AUTH_USERNAME).evaluateAttributeExpressions().getValue());
    +        final String authenticationPassword = trimToEmpty(context.getProperty(PROP_BASIC_AUTH_PASSWORD).evaluateAttributeExpressions().getValue());
    --- End diff --
    
    I'll force use of HTTPS for basic auth. That's probably safer.


---

[GitHub] nifi pull request #2585: NIFI-5019 - Added HTTP 'basic' authentication to Li...

Posted by sbouchex <gi...@git.apache.org>.
Github user sbouchex commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2585#discussion_r177656049
  
    --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ListenHTTP.java ---
    @@ -213,6 +260,8 @@ private void createHttpServerFromService(final ProcessContext context) throws Ex
             final Double maxBytesPerSecond = context.getProperty(MAX_DATA_RATE).asDataSize(DataUnit.B);
             final StreamThrottler streamThrottler = (maxBytesPerSecond == null) ? null : new LeakyBucketStreamThrottler(maxBytesPerSecond.intValue());
             final int returnCode = context.getProperty(RETURN_CODE).asInteger();
    +        final String authenticationUsername = trimToEmpty(context.getProperty(PROP_BASIC_AUTH_USERNAME).evaluateAttributeExpressions().getValue());
    +        final String authenticationPassword = trimToEmpty(context.getProperty(PROP_BASIC_AUTH_PASSWORD).evaluateAttributeExpressions().getValue());
    --- End diff --
    
    @bbende Changes done and only activated with SSL is enabled.


---

[GitHub] nifi pull request #2585: NIFI-5019 - Added HTTP 'basic' authentication to Li...

Posted by bbende <gi...@git.apache.org>.
Github user bbende commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2585#discussion_r177489251
  
    --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ListenHTTP.java ---
    @@ -213,6 +260,8 @@ private void createHttpServerFromService(final ProcessContext context) throws Ex
             final Double maxBytesPerSecond = context.getProperty(MAX_DATA_RATE).asDataSize(DataUnit.B);
             final StreamThrottler streamThrottler = (maxBytesPerSecond == null) ? null : new LeakyBucketStreamThrottler(maxBytesPerSecond.intValue());
             final int returnCode = context.getProperty(RETURN_CODE).asInteger();
    +        final String authenticationUsername = trimToEmpty(context.getProperty(PROP_BASIC_AUTH_USERNAME).evaluateAttributeExpressions().getValue());
    +        final String authenticationPassword = trimToEmpty(context.getProperty(PROP_BASIC_AUTH_PASSWORD).evaluateAttributeExpressions().getValue());
    --- End diff --
    
    Should there be a custom validate that ensures that when username is set that password is also set?
    
    Also, should it be a requirement that an SSLContext is provided when using basic auth? 
    
    If not, then it seems very insecure for the external client to be submitting the basic auth credentials over plain http.


---

[GitHub] nifi issue #2585: NIFI-5019 - Added HTTP 'basic' authentication to ListenHTT...

Posted by zenfenan <gi...@git.apache.org>.
Github user zenfenan commented on the issue:

    https://github.com/apache/nifi/pull/2585
  
    @sbouchex Also please ensure that you run with `contrib-check` profile enabled i.e `mvn clean install -Pcontrib-check`. It has 60 checkstyle violations


---