Chaffelson / nipyapi

A convenient Python wrapper for Apache NiFi
Other
246 stars 76 forks source link

Adds ability to configure client authentication to secured server #43

Closed kevdoran closed 6 years ago

kevdoran commented 6 years ago

Adds the ability to connect to a secured NiFi or NiFi Registry instance using two methods:

A number of bugs in the swager-generated client, particularly for the registry client, have also been addressed.

Note: In order to make these improvements, modifications were made to the stock swagger-codegen Python generator templates that were originally used to bootstrap the REST API clients. The modified templates, along with instructions for how to used them to generate new client code as the Swagger specs evolve, were added to this repository. A note of attribution to the swagger-codegen project was added to the LICENSE.

kevdoran commented 6 years ago

@ragerin here is my PR that is designed to make it easier to create and set the authentication token. See my example in nipyapi.demo.secure_connection.py. Try it out and let me know if it addresses what you found in Issue #42. Thanks!

coveralls commented 6 years ago

Coverage Status

Coverage decreased (-4.6%) to 82.301% when pulling 648e474935e1ca3bd11b301ea554a944d4c48350 on kevdoran:secure-client into 550986c735f75bed728cdc4eef4d7995b353381c on Chaffelson:master.

coveralls commented 6 years ago

Coverage Status

Coverage decreased (-4.6%) to 82.301% when pulling bdf3f179e8337fc97c2462939a7b7b3a98d044b8 on kevdoran:secure-client into 550986c735f75bed728cdc4eef4d7995b353381c on Chaffelson:master.

kevdoran commented 6 years ago

@Chaffelson - great feedback, thanks for taking the time to look this over!

I agree with your structural changes - will do that.

I think the introduction of 1.6.0-SNAPSHOT in the version metadata was unintentional. I was careful not to bring in anything (such as new endpoints or fields) that would not be available in NiFi 1.5.0 or NiFi Registry 0.1.0). I did leverage the snapshot swagger specs to test that fixes in those project do in fact fix the auto-generated python client. The version numbers must have slipped in, I'll revert those.

Yes, currently it's mostly been tested by by the demo.secure_connection module, as well as manual testing I've done (running that demo creates a nice test environment in docker that you can then interact with from a Python console using nipyapi).

When I extract the security helper methods to their own module as part of this PR, I'll also add unit tests for that module, so that will help a bit. A full integration test will require tweaks to the docker-compose and tox setup, which I do want to get to soon. If not as part of this PR, it might be worth opening a new issue to keep track of that item!

Chaffelson commented 6 years ago

Thanks @kevdoran If you want to handle the structural changes and update this PR, then I'll merge it and prepare the stubs for the tox/fixture/docker-compose integration - I've done a lot of work with them recently so I think I can probably knock them together quite quickly, and this will get the PR in place for other users to test out. I'm happy with testing via the demo.secure_connection for this PR.

kevdoran commented 6 years ago

@Chaffelson sounds like a plan! thanks!

kevdoran commented 6 years ago

Closing this PR as work has moved to a new branch: https://github.com/Chaffelson/nipyapi/tree/pr/43