Ejemplo n.º 1
0
def test_verify(name):
    # Load the SAML XML document to verify.
    filename = path.join(BASE_DIR, '%s-signed.xml' % name)
    expected = etree.parse(filename).getroot()

    # Sign the result.
    with open(path.join(BASE_DIR, 'rsapub.pem'), 'r') as stream:
        assert saml.verify(expected, stream)
Ejemplo n.º 2
0
def test_verify(name):
    # Load the SAML XML document to verify.
    filename = path.join(BASE_DIR, '%s-signed.xml' % name)
    expected = etree.parse(filename).getroot()

    # Sign the result.
    with open(path.join(BASE_DIR, 'rsapub.pem'), 'r') as stream:
        assert saml.verify(expected, stream)
Ejemplo n.º 3
0
def test_verify_with_bad_signature_returns_False(name):
    filename = path.join(BASE_DIR, '%s-signed.xml' % name)
    expected = etree.parse(filename).getroot()

    signature_node = xmlsec.tree.find_node(expected, xmlsec.Node.SIGNATURE)
    signature_node.clear()

    with open(path.join(BASE_DIR, 'rsapub.pem'), 'r') as stream:
        assert saml.verify(expected, stream) is False
Ejemplo n.º 4
0
def test_verify_with_bad_signature_returns_False(name):
    filename = path.join(BASE_DIR, '%s-signed.xml' % name)
    expected = etree.parse(filename).getroot()

    signature_node = xmlsec.tree.find_node(expected, xmlsec.Node.SIGNATURE)
    signature_node.clear()

    with open(path.join(BASE_DIR, 'rsapub.pem'), 'r') as stream:
        assert saml.verify(expected, stream) is False
Ejemplo n.º 5
0
def test_verify_with_no_signature_returns_False(name):
    filename = path.join(BASE_DIR, '%s-simple.xml' % name)
    expected = etree.parse(filename).getroot()

    with open(path.join(BASE_DIR, 'rsapub.pem'), 'r') as stream:
        assert saml.verify(expected, stream) is False
Ejemplo n.º 6
0
def test_verify_with_no_signature_returns_False(name):
    filename = path.join(BASE_DIR, '%s-simple.xml' % name)
    expected = etree.parse(filename).getroot()

    with open(path.join(BASE_DIR, 'rsapub.pem'), 'r') as stream:
        assert saml.verify(expected, stream) is False