def _build_upstream_auth_info()

in aws_jupyter_proxy/awsproxy.py [0:0]


    def _build_upstream_auth_info(self) -> UpstreamAuthInfo:
        """
        Parses the upstream requests's Authorization header to determine identifying information such as the region and
        the service the request was originally signed for.

        Sample header:
            AWS4-HMAC-SHA256 \
            Credential=SOMEACCESSKEY/20190814/aws_region/aws_service/aws4_request, \
            SignedHeaders=host;x-amz-content-sha256;x-amz-date;x-amz-target;x-amz-user-agent, \
            Signature=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855

        :return: the UpstreamAuthInfo instance
        """
        auth_header_parts = self.upstream_request.headers["Authorization"].split(" ")

        signed_headers = auth_header_parts[2].strip(",").split("=")[1].split(";")
        _, _, region, service_name, _ = auth_header_parts[1].split("=")[1].split("/")
        return UpstreamAuthInfo(service_name, region, signed_headers)