def authenticate(self, environ, identity):
     authorization = AUTHORIZATION(environ)
     try:
         authmeth, auth = authorization.split(' ', 1)
     except ValueError: # not enough values to unpack
         return None
     if authmeth.lower() == 'apikey':
         acc = Account.by_api_key(auth.strip())
         if acc is not None:
             return acc.name
Beispiel #2
0
 def authenticate(self, environ, identity):
     authorization = AUTHORIZATION(environ)
     try:
         authmeth, auth = authorization.split(' ', 1)
     except ValueError:  # not enough values to unpack
         return None
     if authmeth.lower() == 'apikey':
         acc = Account.by_api_key(auth.strip())
         if acc is not None:
             return acc.name
    def authenticate(self, environ, identity):
        """
        Try to authenticate user based on api key identity
        """

        # If identity has apikey we get the account by the api key
        # and return none if no account or apikey is found is found
        if 'apikey' in identity:
            acc = Account.by_api_key(identity.get('apikey'))
            if acc is not None:
                return acc.name

        return None
Beispiel #4
0
    def authenticate(self, environ, identity):
        """
        Try to authenticate user based on api key identity
        """

        # If identity has apikey we get the account by the api key
        # and return none if no account or apikey is found is found
        if 'apikey' in identity:
            acc = Account.by_api_key(identity.get('apikey'))
            if acc is not None:
                return acc.name

        return None
Beispiel #5
0
 def test_account_lookup_by_api_key(self):
     res = Account.by_api_key(self.acc.api_key)
     assert res == self.acc