Determine which TUF root to show based on actual access, not requested

access
This commit is contained in:
Evan Cordell 2017-03-22 07:38:52 -04:00
parent 7b411b2c25
commit 43dd974dca
5 changed files with 61 additions and 38 deletions

View file

@ -25,10 +25,10 @@ class TestRegistryV2Auth(unittest.TestCase):
def tearDown(self):
finished_database_for_testing(self)
def _generate_token_data(self, access=[], audience=TEST_AUDIENCE, user=TEST_USER, iat=None,
def _generate_token_data(self, access=[], context=None, audience=TEST_AUDIENCE, user=TEST_USER, iat=None,
exp=None, nbf=None, iss=None):
_, subject = build_context_and_subject(user, None, None)
_, subject = build_context_and_subject(user, None, None, None)
return {
'iss': iss or instance_keys.service_name,
'aud': audience,
@ -37,6 +37,7 @@ class TestRegistryV2Auth(unittest.TestCase):
'exp': exp if exp is not None else int(time.time() + TOKEN_VALIDITY_LIFETIME_S),
'sub': subject,
'access': access,
'context': context,
}
def _generate_token(self, token_data, key_id=None, private_key=None, skip_header=False, alg=None):