From 17223926c16a4f9779078236c6460ab9477f9d72 Mon Sep 17 00:00:00 2001 From: Tony Mack Date: Wed, 21 May 2014 22:37:46 -0400 Subject: [PATCH] pass options to auth.check --- sfa/methods/Allocate.py | 3 +-- sfa/methods/ListResources.py | 4 +--- sfa/methods/Provision.py | 2 +- sfa/methods/Renew.py | 4 +--- sfa/methods/Status.py | 3 +-- 5 files changed, 5 insertions(+), 11 deletions(-) diff --git a/sfa/methods/Allocate.py b/sfa/methods/Allocate.py index ff543b73..f255232a 100644 --- a/sfa/methods/Allocate.py +++ b/sfa/methods/Allocate.py @@ -37,10 +37,9 @@ class Allocate(Method): def call(self, xrn, creds, rspec, options): xrn = Xrn(xrn, type='slice') self.api.logger.info("interface: %s\ttarget-hrn: %s\tmethod-name: %s"%(self.api.interface, xrn.get_hrn(), self.name)) - (speaking_for, _) = urn_to_hrn(options.get('geni_speaking_for')) # Find the valid credentials - valid_creds = self.api.auth.checkCredentials(creds, 'createsliver', xrn.get_hrn(), speaking_for_hrn=speaking_for) + valid_creds = self.api.auth.checkCredentials(creds, 'createsliver', xrn.get_hrn(), options=options) # use the expiration from the first valid credential to determine when # the slivers should expire. expiration = datetime_to_string(Credential(cred=valid_creds[0]).expiration) diff --git a/sfa/methods/ListResources.py b/sfa/methods/ListResources.py index a9ffe760..e7f16318 100644 --- a/sfa/methods/ListResources.py +++ b/sfa/methods/ListResources.py @@ -33,10 +33,8 @@ class ListResources(Method): else: raise SfaInvalidArgument('Must specify an rspec version option. geni_rspec_version cannot be null') - (speaking_for, _) = urn_to_hrn(options.get('geni_speaking_for')) - # Find the valid credentials - valid_creds = self.api.auth.checkCredentials(creds, 'listnodes', speaking_for_hrn=speaking_for) + valid_creds = self.api.auth.checkCredentials(creds, 'listnodes', options=options) # get hrn of the original caller origin_hrn = options.get('origin_hrn', None) diff --git a/sfa/methods/Provision.py b/sfa/methods/Provision.py index a3fd0feb..578f6d23 100644 --- a/sfa/methods/Provision.py +++ b/sfa/methods/Provision.py @@ -36,7 +36,7 @@ class Provision(Method): # Find the valid credentials valid_creds = self.api.auth.checkCredentials(creds, 'createsliver', xrns, check_sliver_callback = self.api.driver.check_sliver_credentials, - speaking_for_hrn=speaking_for) + options=options) origin_hrn = Credential(cred=valid_creds[0]).get_gid_caller().get_hrn() self.api.logger.info("interface: %s\tcaller-hrn: %s\ttarget-hrn: %s\tmethod-name: %s"%(self.api.interface, origin_hrn, xrns, self.name)) result = self.api.manager.Provision(self.api, xrns, creds, options) diff --git a/sfa/methods/Renew.py b/sfa/methods/Renew.py index 7b470f10..5aef4578 100644 --- a/sfa/methods/Renew.py +++ b/sfa/methods/Renew.py @@ -32,12 +32,10 @@ class Renew(Method): self.api.logger.info("interface: %s\ttarget-hrn: %s\tcaller-creds: %s\tmethod-name: %s"%(self.api.interface, urns, creds, self.name)) - (speaking_for, _) = urn_to_hrn(options.get('geni_speaking_for')) - # Find the valid credentials valid_creds = self.api.auth.checkCredentials(creds, 'renewsliver', urns, check_sliver_callback = self.api.driver.check_sliver_credentials, - speaking_for_hrn=speaking_for) + options=options) # Validate that the time does not go beyond the credential's expiration time requested_time = utcparse(expiration_time) diff --git a/sfa/methods/Status.py b/sfa/methods/Status.py index 36da58e1..76e967d2 100644 --- a/sfa/methods/Status.py +++ b/sfa/methods/Status.py @@ -19,10 +19,9 @@ class Status(Method): returns = Parameter(dict, "Status details") def call(self, xrns, creds, options): - (speaking_for, _) = urn_to_hrn(options.get('geni_speaking_for')) valid_creds = self.api.auth.checkCredentials(creds, 'sliverstatus', xrns, check_sliver_callback = self.api.driver.check_sliver_credentials, - speaking_for_hrn=speaking_for) + options=options) self.api.logger.info("interface: %s\ttarget-hrn: %s\tmethod-name: %s"%(self.api.interface, xrns, self.name)) return self.api.manager.Status(self.api, xrns, creds, options) -- 2.43.0