Permalink
Please sign in to comment.
Browse files
Refactor auth and separate API from main app
Provide a way to construct just the API as a standalone WSGI app and include this wholesale as a view inside the main site. This means that they can use separate authentication policies for the following benefits: - The API can be deployed and integrated into other applications completely independently. - The API app can be configured with a simpler authentication policy that does not access the session. To accomplish this: - Provide a `create_api` function in `h.app` that can construct a WSGI application that serves only the API. - Extract resource endpoint authorization into a tween. This tween sets the initial value of the `REMOTE_USER` environment key so that the provided API application use the `RemoteUserAuthenticationPolicy`. - Integrate authentication with the API by having the callback for the authentication policy provide the OAuth client as a consumer role. By not accessing the OAuth attributes in the API views, enable the aforementioned integration flexibility. - Use a normal `SessionAuthenticationPolicy` for the main site. Isolate the Annotator Auth token handling to make it easy to migrate to the new token system. - Generate standard web token claims and some backwards compatibility claims for the Annotator Auth plugin. - Use a tween to port the X-Annotator-Auth-Token headers to isolate the legacy code paths from the core authentication machinery. The`h.oauth` package can disappear completely as everything is packed neatly into `h.auth`. Close #1296.
- Loading branch information...
Showing
with
518 additions
and 726 deletions.
- +1 −15 h/__init__.py
- +1 −2 h/accounts/events.py
- +1 −2 h/accounts/subscribers.py
- +1 −4 h/accounts/views.py
- +12 −13 h/api.py
- +44 −12 h/app.py
- +235 −0 h/auth.py
- +0 −83 h/authentication.py
- +0 −151 h/authorization.py
- BIN h/favicon.ico
- +31 −1 h/interfaces.py
- +3 −5 h/models.py
- +0 −17 h/oauth/__init__.py
- +0 −32 h/oauth/interfaces.py
- +0 −29 h/oauth/lib.py
- +0 −24 h/oauth/test/lib_test.py
- +0 −45 h/oauth/test/tokens_test.py
- +0 −51 h/oauth/tokens.py
- +7 −8 h/resources.py
- +7 −8 h/script.py
- +0 −23 h/security.py
- +1 −0 h/streamer.py
- +6 −6 h/subscribers.py
- +154 −0 h/test/auth_test.py
- +0 −85 h/test/authentication_test.py
- +0 −110 h/test/authorization_test.py
- +13 −0 h/tweens.py
- +1 −0 setup.py
Oops, something went wrong.
0 comments on commit
29c1500