Exemple #1
0
def _get_certificate(name):
    try:
        with open(name, 'r') as f:
            body = f.read()
    except IOError:
        raise exception.CertificateFilesUnavailable()
    resp = flask.make_response(body, http_client.OK)
    resp.headers['Content-Type'] = 'application/x-pem-file'
    return resp
Exemple #2
0
    def _get_certificate(self, name):
        try:
            with open(name, 'r') as f:
                body = f.read()
        except IOError:
            raise exception.CertificateFilesUnavailable()

        # NOTE(jamielennox): We construct the webob Response ourselves here so
        # that we don't pass through the JSON encoding process.
        headers = [('Content-Type', 'application/x-pem-file')]
        return webob.Response(body=body, headerlist=headers, status="200 OK")
Exemple #3
0
    def _get_certificate(self, name):
        # If we aren't using the PKI Provider then we should return a 403
        if not isinstance(self.token_provider_api.driver, pki.Provider):
            raise exception.PKITokenExpected()

        try:
            with open(name, 'r') as f:
                body = f.read()
        except IOError:
            raise exception.CertificateFilesUnavailable()

        # NOTE(jamielennox): We construct the webob Response ourselves here so
        # that we don't pass through the JSON encoding process.
        headers = [('Content-Type', 'application/x-pem-file')]
        return webob.Response(body=body, headerlist=headers, status="200 OK")