Oauth1 manager sets consumer secret

Rather than have the driver set the consumer secret (so that each
driver has to implement this), have the manager set the consumer
secret.

Also, don't mutate the input paramter.

Change-Id: I38d023769c565229362eaa2c31d586ef6a312393
changes/39/282439/2
Brant Knudson 7 years ago
parent 37999ec7f8
commit fa5ae4a274

@ -101,7 +101,6 @@ class OAuth1(core.Oauth1DriverV8):
self.get_consumer_with_secret(consumer_id))
def create_consumer(self, consumer):
consumer['secret'] = uuid.uuid4().hex
session = sql.get_session()
with session.begin():
consumer_ref = Consumer.from_dict(consumer)

@ -161,6 +161,8 @@ class Manager(manager.Manager):
super(Manager, self).__init__(CONF.oauth1.driver)
def create_consumer(self, consumer_ref, initiator=None):
consumer_ref = consumer_ref.copy()
consumer_ref['secret'] = uuid.uuid4().hex
ret = self.driver.create_consumer(consumer_ref)
notifications.Audit.created(self._CONSUMER, ret['id'], initiator)
return ret

Loading…
Cancel
Save