lib/ciam/ruby-saml/logout_response.rb in ciam-es-0.0.8 vs lib/ciam/ruby-saml/logout_response.rb in ciam-es-0.0.9
- old
+ new
@@ -51,22 +51,17 @@
time = Time.now.utc.strftime("%Y-%m-%dT%H:%M:%SZ")
root = response_doc.add_element "saml2p:LogoutResponse", { "xmlns:saml2p" => PROTOCOL }
root.attributes['ID'] = uuid
root.attributes['IssueInstant'] = time
root.attributes['Version'] = "2.0"
+ root.attributes['Destination'] = @settings.single_logout_destination
# Just convenient naming to accept both names as InResponseTo
if opt[:transaction_id]
root.attributes['InResponseTo'] = opt[:transaction_id]
elsif opt[:in_response_to]
root.attributes['InResponseTo'] = opt[:in_response_to]
end
- if opt[:status]
- status = root.add_element "saml2p:Status"
- status_code = status.add_element "saml2p:StatusCode", {
- "Value" => opt[:status]
- }
- end
if @settings && @settings.issuer
issuer = root.add_element "saml:Issuer", {
"xmlns:saml" => "urn:oasis:names:tc:SAML:2.0:assertion"
}
issuer.text = @settings.issuer
@@ -78,11 +73,18 @@
# embed signature
if @settings.metadata_signed && @settings.sp_private_key && @settings.sp_cert
private_key = @settings.get_sp_key
response_doc.sign_document(private_key, cert)
- end
+ end
+ if opt[:status]
+ status = root.add_element "saml2p:Status"
+ status_code = status.add_element "saml2p:StatusCode", {
+ "Value" => opt[:status]
+ }
+ end
+
Logging.debug "Created LogoutResponse:\n #{response_doc}"
return response_doc.to_s
end