Exemplo n.º 1
0
 def create(self, data):
     # I don't think we need a consumer factory for this... just
     # inherit/redefine this form for your consumers.
     data['key'] = key = random_string(24)
     data['secret'] = secret = random_string(24)
     self._data = data
     return Consumer(key, secret, data['title'], data['domain'])
Exemplo n.º 2
0
 def _generateBaseToken(self, consumer_key):
     key = random_string(24)
     secret = random_string(24)
     token = Token(key, secret)
     token.consumer_key = consumer_key
     token.timestamp = int(time.time())
     return token
Exemplo n.º 3
0
    def set_verifier(self, verifier=None):
        """
        Based on implementation from python-oauth2
        
        This uses the random_string method to generate the verifier key.
        Does not regenerate a new key if verifier is already set, unless
        a specific verifier is specified which will the be set.  To
        generate a new random value, set the verifier parameter to True.
        """

        if verifier is True or (verifier is None and self.verifier is None):
            # As the user could hit back or whatever reason and reload
            # the key before the consumer gets to complete the request,
            # and to simplify how this is invoked by the authorization
            # form, we only generate this once, unless the caller really
            # wants to do this.
            self.verifier = random_string(24)
            return

        if verifier is not None:
            # fieldproperty should validate this input automatically.
            self.verifier = verifier
Exemplo n.º 4
0
 def __init__(self):
     self.__dummy_key = random_string(24)
     self.__dummy_secret = random_string(24)
     self._consumers = OOBTree()