Beispiel #1
0
    def test_authenticate_error_presigned_url_invalid_escher_key(self):
        escher = Escher(self.credential_scope, self.get_options('2011-05-11T12:00:00.000Z'))

        try:
            uri = '/something?foo=bar&baz=barbaz&X-EMS-Algorithm=EMS-HMAC-SHA256&X-EMS-Credentials=INVALID%2F20110511%2Fus-east-1%2Fhost%2Faws4_request&X-EMS-Date=20110511T120000Z&X-EMS-Expires=123456&X-EMS-SignedHeaders=host&X-EMS-Signature=fbc9dbb91670e84d04ad2ae7505f4f52ab3ff9e192b8233feeae57e9022c2b67'
            escher.authenticate(self.get_request(uri), self.key_db)
            self.fail('No exception thrown')
        except EscherException as e:
            self.assertEqual('Invalid Escher key', str(e))
Beispiel #2
0
    def test_authenticate_valid_presigned_url_with_query(self):
        escher = Escher(self.credential_scope, self.get_options('2011-05-11T12:00:00.000Z'))

        uri = '/something?foo=bar&baz=barbaz&X-EMS-Algorithm=EMS-HMAC-SHA256&X-EMS-Credentials=th3K3y%2F20110511%2Fus-east-1%2Fhost%2Faws4_request&X-EMS-Date=20110511T120000Z&X-EMS-Expires=123456&X-EMS-SignedHeaders=host&X-EMS-Signature=fbc9dbb91670e84d04ad2ae7505f4f52ab3ff9e192b8233feeae57e9022c2b67'
        result = escher.authenticate(self.get_request(uri), self.key_db)

        self.assertEqual('th3K3y', result)