Beispiel #1
0
 def requestAvatarId(self, credentials):
     # 'credentials' is a single string, the browserid assertion coming
     # from the web client. We send it to the online verifier service for
     # checking. In the long run (i.e. after the protocol has settled
     # down), it is better (i.e. removes browserid.org from the reliance
     # set) to perform the cryptographic verification locally. This will
     # require fetching a pubkey from the IdP's /.well-known/ directory
     # and performing signature checking with the result.
     body = json.dumps({"assertion": credentials.assertion,
                        "audience": self.audience})
     headers = Headers()
     headers.addRawHeader("Content-Type", "application/json")
     d = self.agent.request("POST", self.verifier_url,
                            headers=headers,
                            bodyProducer=MemoryBodyProducer(body))
     d.addCallback(getBody)
     d.addCallback(json.loads)
     d.addCallback(self._parse_response)
     return d
Beispiel #2
0
 def requestAvatarId(self, credentials):
     # 'credentials' is a single string, the browserid assertion coming
     # from the web client. We send it to the online verifier service for
     # checking. In the long run (i.e. after the protocol has settled
     # down), it is better (i.e. removes browserid.org from the reliance
     # set) to perform the cryptographic verification locally. This will
     # require fetching a pubkey from the IdP's /.well-known/ directory
     # and performing signature checking with the result.
     body = json.dumps({"assertion": credentials.assertion,
                        "audience": self.audience})
     headers = Headers()
     headers.addRawHeader("Content-Type", "application/json")
     d = self.agent.request("POST", self.verifier_url,
                            headers=headers,
                            bodyProducer=MemoryBodyProducer(body))
     d.addCallback(getBody)
     d.addCallback(json.loads)
     d.addCallback(self._parse_response)
     return d
Beispiel #3
0
 def test_header_isolation(self):
     agent = CassetteAgent(self.agent, '')
     finished = agent.request('GET', 'http://foo.test/')
     request, result = self.protocol.requests.pop()
     headers = Headers()
     headers.addRawHeader('Content-Encoding', 'gzip')
     response = Response._construct(('HTTP', 1, 1), 200, 'OK', headers,
                                    AbortableStringTransport(), request)
     response._bodyDataFinished()
     result.callback(response)
     @inlineCallbacks
     def assert_intact_headers(agent_response):
         yield readBody(agent_response)
         agent_response.headers.removeHeader('Content-Encoding')
         interaction = agent.cassette.as_dict()['http_interactions'][0]
         self.assertEqual(
             ['gzip'],
             interaction['response']['headers']['Content-Encoding'])
         returnValue(agent_response)
     finished.addCallback(assert_intact_headers)
     return finished
Beispiel #4
0
def defaultHeaders():
	headers = Headers()
	headers.addRawHeader('User-Agent', 'IPtvDream-%s/%s' % (NAME, VERSION))
	return headers