Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using oauth and openapi #86

Merged
merged 11 commits into from
Aug 1, 2019
Merged

using oauth and openapi #86

merged 11 commits into from
Aug 1, 2019

Conversation

cehbrecht
Copy link
Member

This PR fixes issue #22.

Changes:

  • using oauth tokens (uuid, JWT with secret or certificate).
  • openapi interface for OWS service registration.
  • refactoring.
  • updated tests and docs.

@cehbrecht cehbrecht added this to the 0.6.0 milestone Jul 25, 2019
@cehbrecht cehbrecht self-assigned this Jul 25, 2019
@cehbrecht
Copy link
Member Author

@fmigneault are you ok with this PR? The adapter (and maybe other things) need to be fixed. But this could happen in a follow-up PR.

I have skipped the twitcher.datatypes ... they were kind of a duplicate of twitcher.models. There is now a twitcher.owsregistry which was before in twitcher.api.py and I have skipped the IRegistry interface. Maybe you like some of this back?

The xmlrpc interface is now replaced by an OpenAPI ... in the module twitcher.api.

Let me know if you like things changed are push them directly to this PR.

docs/source/tutorial.rst Outdated Show resolved Hide resolved
Copy link
Contributor

@fmigneault fmigneault left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Multiple breaking changes for Magpie that should be somewhat easy to fix.

Also, many functionalities (and planned todos) duplicated from Magpie. I'm questioning why not use this component directly and combine efforts in improving it if there are any missing requirements for you?

docs/source/configuration.rst Outdated Show resolved Hide resolved
twitcher/owsproxy.py Outdated Show resolved Hide resolved
twitcher/owsregistry.py Outdated Show resolved Hide resolved
twitcher/adapter/default.py Outdated Show resolved Hide resolved
twitcher/adapter/default.py Show resolved Hide resolved
twitcher/models/__init__.py Outdated Show resolved Hide resolved
authz_policy = ACLAuthorizationPolicy()
config.set_authorization_policy(authz_policy)
config.set_authentication_policy(authn_policy)
config.set_root_factory(lambda request: Root())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need to be called via the adapter's configurator_factory as Magpie defines these with different settings.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only used by oauth2 module to register oauth clients. Made optional in config.

@@ -53,6 +53,39 @@ Do the same as above using the ``Makefile``.
$ make lint
$ make coverage

Upgrade Database
----------------
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe database migration should be done automatically, otherwise chances are Twitcher's schemas in the code vs the retrieved ones from the db will mismatch and just cause the app to crash.
Expected behaviour should be that the db and its schemas are migrated up/down on boot time to match the installed Twitcher version.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't know ... I thought it would be safer to run make migrate intentionally. Though it might not harm when run each time before make start.

This first step is only needed in development to generate a new database schema version.

Upgrade to that revision:
Before you can start the service you need to initialize or upgrade the database:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see previous note

docs/source/overview.rst Outdated Show resolved Hide resolved
@cehbrecht
Copy link
Member Author

@fmigneault Thanks for review :) I have made updates according to your comments. Please check if they fit, especially for the new twitcher.interface.py.

I have removed the store interface ... the store is only used by the registry, so the registry interface should include it.

@@ -160,25 +159,11 @@ def owsproxy_view(request):
service = request.owsregistry.get_service_by_name(service_name)
except Exception:
return OWSAccessFailed("Could not find service")
if verify_request(request, service) is False:
if request.verify_ows_request is False:
Copy link
Contributor

@fmigneault fmigneault Jul 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

naming is not intuitive as it feels like a function name
instead use is_ows_request_verified or similar

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done ... but shortened to is_verified.

Copy link
Contributor

@fmigneault fmigneault left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems good
only needs changing the method name to make it more intuitive

@cehbrecht
Copy link
Member Author

@fmigneault ok to merge to master?

@fmigneault
Copy link
Contributor

@fmigneault ok to merge to master?

@cehbrecht yes go ahead :)

@cehbrecht cehbrecht merged commit 071f38c into master Aug 1, 2019
@cehbrecht cehbrecht deleted the issue-22-oauth branch August 1, 2019 08:53
@cehbrecht
Copy link
Member Author

@fmigneault done. Thanks for you support :)

@cehbrecht
Copy link
Member Author

@dbyrns @fmigneault There was a comment on the breaking changes in Twitcher introduced with version 0.6.x ... somehow I can not see it anymore. Looks like sins of the past. I hope it is not too much to adapt. I will add you in the review for future changes. You can also adapt the Twitcher.

@dbyrns
Copy link
Collaborator

dbyrns commented Oct 22, 2020

Thank you very much it's appreciated. Have a good day.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants