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
This commit is contained in:
Brant Knudson 2016-02-19 09:53:00 -06:00
parent 37999ec7f8
commit fa5ae4a274
2 changed files with 2 additions and 1 deletions

View File

@ -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)

View File

@ -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