コード例 #1
0
ファイル: provider.py プロジェクト: ryepdx/bittrails_platform
    def validate_access_token(self, client_key, resource_owner_key):

        token = None
        client = Client.find_one({'client_key':client_key})
    
        if client:
            token = AccessToken.find_one(
                {'token':resource_owner_key, 'client_id': client['_id']})
        
        return token != None
コード例 #2
0
ファイル: provider.py プロジェクト: ryepdx/bittrails_platform
 def get_access_token_secret(self, client_key, resource_owner_key):
     client = Client.find_one({'client_key':client_key})
 
     if client:
         token = AccessToken.find_one(
             {'token':resource_owner_key,
              'client_id': client['_id']})
              
         if token:
             return token['secret']
                  
     return None
コード例 #3
0
    def validate_access_token(self, client_key, resource_owner_key):

        token = None
        client = Client.find_one({'client_key': client_key})

        if client:
            token = AccessToken.find_one({
                'token': resource_owner_key,
                'client_id': client['_id']
            })

        return token != None
コード例 #4
0
    def get_access_token_secret(self, client_key, resource_owner_key):
        client = Client.find_one({'client_key': client_key})

        if client:
            token = AccessToken.find_one({
                'token': resource_owner_key,
                'client_id': client['_id']
            })

            if token:
                return token['secret']

        return None
コード例 #5
0
ファイル: provider.py プロジェクト: ryepdx/bittrails_platform
    def validate_realm(self, client_key, access_token, uri=None, required_realm=None):

        if not required_realm:
            return True

        # insert other check, ie on uri here

        client = Client.find_one({'client_key':client_key})
        
        if client:
            token = AccessToken.find_one(
                {'token':access_token, 'client_id': client['_id']})
            
            if token:
                return token['realm'] in required_realm
        
        return False
コード例 #6
0
ファイル: provider.py プロジェクト: ryepdx/bittrails_platform
    def save_timestamp_and_nonce(self, client_key, timestamp, nonce,
            request_token=None, access_token=None):
        
        client = Client.find_one({'client_key':client_key})
        
        if client:
            nonce = Nonce(nonce, timestamp)
            nonce.client_id = client['_id']

            if request_token:
                req_token = RequestToken.find_one({'token':request_token})
                nonce.request_token_id = req_token['_id']

            if access_token:
                token = AccessToken.find_one({'token':access_token})
                nonce.access_token_id = token['_id']

            nonce.insert()
コード例 #7
0
    def save_timestamp_and_nonce(self,
                                 client_key,
                                 timestamp,
                                 nonce,
                                 request_token=None,
                                 access_token=None):

        client = Client.find_one({'client_key': client_key})

        if client:
            nonce = Nonce(nonce, timestamp)
            nonce.client_id = client['_id']

            if request_token:
                req_token = RequestToken.find_one({'token': request_token})
                nonce.request_token_id = req_token['_id']

            if access_token:
                token = AccessToken.find_one({'token': access_token})
                nonce.access_token_id = token['_id']

            nonce.insert()
コード例 #8
0
    def validate_realm(self,
                       client_key,
                       access_token,
                       uri=None,
                       required_realm=None):

        if not required_realm:
            return True

        # insert other check, ie on uri here

        client = Client.find_one({'client_key': client_key})

        if client:
            token = AccessToken.find_one({
                'token': access_token,
                'client_id': client['_id']
            })

            if token:
                return token['realm'] in required_realm

        return False