Exemple #1
0
 def test_decoding_failure(self):
     self.form['SAMLRequest'] = 'XXX_not_base64_data_XXX'
     parser = HTTPPostRequestParser(self.form)
     with pytest.raises(RequestParserError) as excinfo:
         parser.parse()
     exc = excinfo.value
     self.assertEqual("Impossibile decodificare l'elemento 'SAMLRequest'",
                      exc.args[0])
Exemple #2
0
 def test_missing_data(self):
     del self.form['SAMLRequest']
     parser = HTTPPostRequestParser(self.form)
     with pytest.raises(RequestParserError) as excinfo:
         parser.parse()
     exc = excinfo.value
     self.assertEqual("Dato mancante nella request: 'SAMLRequest'",
                      exc.args[0])
Exemple #3
0
 def _handle_http_post(self, action):
     # FIXME: replace the following code with a call to a function
     # in the parser.py module after metadata refactoring.
     # The IdpServer class should not
     # be responsible of request parsing, or know anything
     # about request parsing *at all*.
     saml_msg = self.unpack_args(request.form)
     request_data = HTTPPostRequestParser(saml_msg).parse()
     deserializer = get_http_post_request_deserializer(
         request_data, action, self.server.metadata)
     saml_tree = deserializer.deserialize()
     certs = self._get_certificates_by_issuer(saml_tree.issuer.text)
     for cert in certs:
         HTTPPostSignatureVerifier(cert, request_data).verify()
     return SPIDRequest(request_data, saml_tree)
Exemple #4
0
 def test_relay_state_is_optional(self):
     del self.form['RelayState']
     parser = HTTPPostRequestParser(self.form)
     parsed = parser.parse()
     self.assertIsNone(parsed.relay_state)
Exemple #5
0
 def test_valid_request(self):
     parser = HTTPPostRequestParser(self.form)
     parsed = parser.parse()
     self.assertEqual(parsed.saml_request, b'saml_request')
     self.assertEqual(parsed.relay_state, 'relay_state')