Skip to content
Browse files

fix pylint related errors

  • Loading branch information...
1 parent a09066b commit ecdaf04a8c49489ca0607253c1f4bd7a5c93a6e7 @bodenr bodenr committed Feb 26, 2014
Showing with 7 additions and 5 deletions.
  1. +4 −2 jumpgate/identity/drivers/core.py
  2. +3 −3 jumpgate/identity/drivers/sl/tokens.py
View
6 jumpgate/identity/drivers/core.py
@@ -68,7 +68,8 @@ def create_credentials(self, token):
def validate_access(self, token, user_id=None,
username=None, tenant_id=None):
- """Validate the specified token still has access.
+ """Validate the specified token still has access. Failure to validate
+ the given token should raise an exception in the method implementation.
:param user_id: If specified the user ID to validate token access for.
:param username: If specified the username to validate token
@@ -195,7 +196,8 @@ def validate_access(self, token, user_id=None,
username=None, tenant_id=None):
self.validate_token(token, user_id, username, tenant_id)
auth = auth_driver().authenticate(self.create_credentials(token))
- return auth['user']
+ if auth is None:
+ raise exceptions.InvalidTokenError("Token is no longer valid")
def tenant_id(self, token):
return token['tenant_id']
View
6 jumpgate/identity/drivers/sl/tokens.py
@@ -171,9 +171,9 @@ def on_post(self, req, resp):
class TokenV2(object):
def on_get(self, req, resp, token_id):
token = identity.token_id_driver().token_from_id(token_id)
- user = identity.token_driver().validate_access(token, tenant_id=
- req.get_param('belongsTo'))
- access = get_access(token_id, token, user)
+ identity.token_driver().validate_access(token, tenant_id=
+ req.get_param('belongsTo'))
+ access = get_access(token_id, token)
resp.status = 200
resp.body = {'access': access}

0 comments on commit ecdaf04

Please sign in to comment.
Something went wrong with that request. Please try again.