def test_parse_and_extract_values(self):
        res = LogoutResponse(test_raw_response)

        # Parse the document into a string with same xml tool to get comparable results
        parsed_document = minidom.parseString(etree.tostring(res.document))
        parsed_expected = minidom.parseString(expected_decoded_response)

        eq(parsed_document.toprettyxml(), parsed_expected.toprettyxml())
        eq(res.is_success(), True)
def handle_logout_response():
    SAMLResponse = request.values['SAMLResponse']
    print "SAMLResponse", SAMLResponse

    logout_response = LogoutResponse(SAMLResponse)
    if logout_response.is_success():
        print "User was successfully logged out."
        user_info = None
    else:
        print "Logout failed."

    return render_template('home.html')
def handle_logout_response():
    SAMLResponse = request.values['SAMLResponse']
    print "SAMLResponse", SAMLResponse

    logout_response = LogoutResponse(SAMLResponse)
    if logout_response.is_success():
        print "User was successfully logged out."
        user_info = None
    else:
        print "Logout failed."

    return render_template('home.html')
def handle_logout_response():
    # Logout request from ID-porten
    if 'SAMLRequest' in request.values:
        return logout()

    saml_response = request.values['SAMLResponse']
    logout_response = LogoutResponse(saml_response)
    if not logout_response.is_success():
        app.logger.info(("Logout from Idporten failed, proceeding with logout"
                         "anyway"))

    logout_user()
    return redirect("/")
def handle_idporten_logout_response():
    # If user logs out IN IDporten, then IDporten sends the logout request to us
    # , and we need to continue the logout process the normal way
    if 'SAMLRequest' in request.values:
        return logout()

    # Got response from logout request from IDporten, continue logging out
    saml_response = request.values['SAMLResponse']
    logout_response = LogoutResponse(saml_response)
    if not logout_response.is_success():
        app.logger.info(("Logout from Idporten failed, proceeding with logout"
                         "anyway"))

    logout_user()
    return redirect("/")