diff options
author | Victor Shyba <victor.shyba@gmail.com> | 2015-10-28 17:58:27 -0300 |
---|---|---|
committer | Victor Shyba <victor.shyba@gmail.com> | 2015-11-03 12:41:37 -0300 |
commit | eaf19626a57d5f5325653fee3aea9db27c9531fe (patch) | |
tree | fce19a8c6841a78698395e31306b5c31c9810e2b /server | |
parent | 421691ef71019d0bcd4447a773efa5e9b15b0c71 (diff) |
[refactor] resource logic encapsulation
Creating a resource from a path to use get_json causes a lot of dirty
code and unexplained things like response[2]. This commit extracts that
logic into a helper to let it more clear about what is happening.
Diffstat (limited to 'server')
-rw-r--r-- | server/src/leap/soledad/server/auth.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/server/src/leap/soledad/server/auth.py b/server/src/leap/soledad/server/auth.py index 01baf1ce..ccbd6fbd 100644 --- a/server/src/leap/soledad/server/auth.py +++ b/server/src/leap/soledad/server/auth.py @@ -189,7 +189,6 @@ class SoledadAuthMiddleware(object): @type prefix: str """ self._app = app - self._state = app.state def _error(self, start_response, status, description, message=None): """ @@ -350,6 +349,10 @@ class SoledadTokenAuthMiddleware(SoledadAuthMiddleware): TOKEN_AUTH_ERROR_STRING = "Incorrect address or token." + def __init__(self, app): + self._state = app.state + super(SoledadTokenAuthMiddleware, self).__init__(app) + def _verify_authentication_scheme(self, scheme): """ Verify if authentication scheme is valid. |