diff --git a/.travis/install.sh b/.travis/install.sh index fa82cccb..c25f1124 100755 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -96,7 +96,6 @@ spec: password: pulp admin_password: pulp pulp_settings: - content_host: $(hostname):24816 token_server: $(hostname):24816/token private_key_path: /var/lib/pulp/tmp/private.pem public_key_path: /var/lib/pulp/tmp/public.pem diff --git a/pulp_docker/app/authorization.py b/pulp_docker/app/authorization.py index 2aac03a5..3f583a99 100644 --- a/pulp_docker/app/authorization.py +++ b/pulp_docker/app/authorization.py @@ -16,7 +16,7 @@ TOKEN_EXPIRATION_TIME = 300 -KNOWN_SERVICES = [settings.CONTENT_HOST] +KNOWN_SERVICES = [settings.CONTENT_ORIGIN] ANONYMOUS_USER = '' EMPTY_ACCESS_SCOPE = '::' diff --git a/pulp_docker/app/serializers.py b/pulp_docker/app/serializers.py index ff5e0cbd..d3983545 100644 --- a/pulp_docker/app/serializers.py +++ b/pulp_docker/app/serializers.py @@ -107,10 +107,7 @@ def to_representation(self, value): """ Converts a base_path into a registry path. """ - if settings.CONTENT_HOST: - host = settings.CONTENT_HOST - else: - host = self.context['request'].get_host() + host = settings.CONTENT_ORIGIN return ''.join([host, '/', value]) diff --git a/pulp_docker/app/token_verification.py b/pulp_docker/app/token_verification.py index 60370541..c74228a4 100644 --- a/pulp_docker/app/token_verification.py +++ b/pulp_docker/app/token_verification.py @@ -98,7 +98,7 @@ def _build_authenticate_string(self, source_path): realm="https://token",service="docker.io",scope="repository:my-app:push". """ realm = f'{self.request.scheme}://{settings.TOKEN_SERVER}' - authenticate_string = f'Bearer realm="{realm}",service="{settings.CONTENT_HOST}"' + authenticate_string = f'Bearer realm="{realm}",service="{settings.CONTENT_ORIGIN}"' if not self._is_verifying_root_endpoint(): scope = f'repository:{source_path}:pull' @@ -132,7 +132,7 @@ def _init_jwt_decoder_config(self): return { 'algorithms': [settings.TOKEN_SIGNATURE_ALGORITHM], 'issuer': settings.TOKEN_SERVER, - 'audience': settings.CONTENT_HOST + 'audience': settings.CONTENT_ORIGIN } def contains_accessible_actions(self, decoded_token): diff --git a/template_config.yml b/template_config.yml index 9f5ace85..5d1d07a9 100644 --- a/template_config.yml +++ b/template_config.yml @@ -35,7 +35,6 @@ plugin_name: pulp_docker plugin_snake: pulp_docker plugin_snake_short: docker pulp_settings: - content_host: $(hostname):24816 token_server: $(hostname):24816/token token_signature_algorithm: ES256 pydocstyle: true