def get_response_xml(parameters, signed=False): """ Returns XML for response, with signatures, if signed is True. """ # Reset signatures. params = {} params.update(parameters) params['RESPONSE_SIGNATURE'] = '' _get_in_response_to(params) template = string.Template(RESPONSE) unsigned = template.substitute(params) log.debug('Unsigned:') log.debug(unsigned) if not signed: return unsigned # Sign it. signature_xml = get_signature_xml(unsigned, params['RESPONSE_ID']) params['RESPONSE_SIGNATURE'] = signature_xml signed = template.substitute(params) log.debug('Signed:') log.debug(signed) return signed
def _get_assertion_xml(template, parameters, signed=False): # Reset signature. params = {} params.update(parameters) params['ASSERTION_SIGNATURE'] = '' template = string.Template(template) _get_in_response_to(params) _get_subject(params) # must come before _get_attribute_statement() _get_attribute_statement(params) unsigned = template.substitute(params) log.debug('Unsigned:') log.debug(unsigned) if not signed: return unsigned # Sign it. signature_xml = get_signature_xml(unsigned, params['ASSERTION_ID']) params['ASSERTION_SIGNATURE'] = signature_xml signed = template.substitute(params) log.debug('Signed:') log.debug(signed) return signed
def get_response_xml(parameters, signed=False): """ Returns XML for response, with signatures, if signed is True. """ # Reset signatures. params = {} params.update(parameters) params['RESPONSE_SIGNATURE'] = '' _get_in_response_to(params) template = string.Template(RESPONSE) unsigned = template.substitute(params) logging.debug('Unsigned:') logging.debug(unsigned) if not signed: return unsigned # Sign it. signature_xml = get_signature_xml(unsigned, params['RESPONSE_ID']) params['RESPONSE_SIGNATURE'] = signature_xml signed = template.substitute(params) logging.debug('Signed:') logging.debug(signed) return signed
def _get_assertion_xml(template, parameters, signed=False): # Reset signature. params = {} params.update(parameters) params['ASSERTION_SIGNATURE'] = '' template = string.Template(template) _get_in_response_to(params) _get_subject(params) # must come before _get_attribute_statement() _get_attribute_statement(params) unsigned = template.substitute(params) logging.debug('Unsigned:') logging.debug(unsigned) if not signed: return unsigned # Sign it. signature_xml = get_signature_xml(unsigned, params['ASSERTION_ID']) params['ASSERTION_SIGNATURE'] = signature_xml signed = template.substitute(params) logging.debug('Signed:') logging.debug(signed) return signed
def _sign_assertion(unsigned, template, params): signature_xml = get_signature_xml(unsigned, params["ASSERTION_ID"]) params["ASSERTION_SIGNATURE"] = signature_xml signed = template.substitute(params) logging.debug("Signed:") logging.debug(signed) return signed
def _get_authnrequest_xml(template, parameters, signed=False): # Reset signature. params = {} params.update(parameters) params['AUTHN_REQUEST_SIGNATURE'] = '' template = string.Template(template) unsigned = template.substitute(params) logging.debug('Unsigned:') logging.debug(unsigned) if not signed: return unsigned # Sign it. signature_xml = get_signature_xml(unsigned, params['AUTHN_REQUEST_ID']) params['AUTHN_REQUEST_SIGNATURE'] = signature_xml signed = template.substitute(params) logging.debug('Signed:') logging.debug(signed) return signed