Beispiel #1
0
 def overlap_config_image(cls, appname, config_tag, config_layer_count, target_repo, target_tag):
     sjwt = Authorize.get_jwt_with_appname(appname)
     tjwt = Authorize.get_jwt_with_appname(target_repo)
     success = configs.utils.overlap_layer_to_image(appname, config_tag, config_layer_count, sjwt,
                                                    target_repo, target_tag, tjwt)
     if not success:
         cls.handle_error("error overlapping config image from tag %s to repo %s, version %s" % (
             config_tag, target_repo, target_tag))
     else:
         logger.info("success overlapping config image from tag %s to repo %s, version %s" % (
             config_tag, target_repo, target_tag))
Beispiel #2
0
def test_verity_app_access():
	groups = [(appname_prefix + "-" + 'foo1').replace('.', '-'),
        (appname_prefix + "-" + 'foo2').replace('.', '-'),
        (appname_prefix + "-" + 'foo3').replace('.', '-')]
	success = Authorize.verify_app_access(groups, 'foo1')
	assert success
	success = Authorize.verify_app_access(groups, 'foo')
	assert not success
	success = Authorize.verify_app_access([], '')
	assert not success
	success = Authorize.verify_app_access([], None)
	assert not success
Beispiel #3
0
def test_verity_app_access():
    groups = [(appname_prefix + "-" + 'foo1').replace('.', '-'),
              (appname_prefix + "-" + 'foo2').replace('.', '-'),
              (appname_prefix + "-" + 'foo3').replace('.', '-')]
    success = Authorize.verify_app_access(groups, 'foo1')
    assert success
    success = Authorize.verify_app_access(groups, 'foo')
    assert not success
    success = Authorize.verify_app_access([], '')
    assert not success
    success = Authorize.verify_app_access([], None)
    assert not success
Beispiel #4
0
def test_verity_app_access():
    groups = [
        group_prefix + hashlib.md5(appname_prefix + 'foo1').hexdigest()[0:30],
        group_prefix + hashlib.md5(appname_prefix + 'foo2').hexdigest()[0:30],
        group_prefix + hashlib.md5(appname_prefix + 'foo3').hexdigest()[0:30]
    ]
    success = Authorize.verify_app_access(groups, 'foo1')
    assert success
    success = Authorize.verify_app_access(groups, 'foo')
    assert not success
    success = Authorize.verify_app_access([], '')
    assert not success
    success = Authorize.verify_app_access([], None)
    assert not success
Beispiel #5
0
 def overlap_config_image(cls, appname, config_tag, config_layer_count,
                          target_repo, target_tag):
     sjwt = Authorize.get_jwt_with_appname(appname)
     tjwt = Authorize.get_jwt_with_appname(target_repo)
     success = configs.utils.overlap_layer_to_image(appname, config_tag,
                                                    config_layer_count,
                                                    sjwt, target_repo,
                                                    target_tag, tjwt)
     if not success:
         cls.handle_error(
             "error overlapping config image from tag %s to repo %s, version %s"
             % (config_tag, target_repo, target_tag))
     else:
         logger.info(
             "success overlapping config image from tag %s to repo %s, version %s"
             % (config_tag, target_repo, target_tag))
Beispiel #6
0
def _get_registry_access_header(app, registry):
    if _is_registry_auth_open(registry):
        from authorize.models import Authorize

        jwt = Authorize.get_jwt_with_appname(app)
        header = {'Authorization': 'Bearer %s' % jwt}
    else:
        header = ''
    return header
Beispiel #7
0
def _get_registry_access_header(app, registry):
    if _is_registry_auth_open(registry):
        from authorize.models import Authorize

        jwt = Authorize.get_jwt_with_appname(app)
        header = {'Authorization': 'Bearer %s' % jwt}
    else:
        header = ''
    return header