@@ -32,14 +32,15 @@ def initialize
3232 def create ( settings , request_id = nil , logout_message = nil , params = { } )
3333 params = create_params ( settings , request_id , logout_message , params )
3434 params_prefix = ( settings . idp_slo_target_url =~ /\? / ) ? '&' : '?'
35+ url = settings . idp_slo_response_service_url || settings . idp_slo_target_url
3536 saml_response = CGI . escape ( params . delete ( "SAMLResponse" ) )
3637 response_params = "#{ params_prefix } SAMLResponse=#{ saml_response } "
3738 params . each_pair do |key , value |
3839 response_params << "&#{ key . to_s } =#{ CGI . escape ( value . to_s ) } "
3940 end
4041
41- raise SettingError . new "Invalid settings, idp_slo_target_url is not set!" if settings . idp_slo_target_url . nil? or settings . idp_slo_target_url . empty?
42- @logout_url = settings . idp_slo_target_url + response_params
42+ raise SettingError . new "Invalid settings, idp_slo_target_url is not set!" if url . nil? or url . empty?
43+ @logout_url = url + response_params
4344 end
4445
4546 # Creates the Get parameters for the logout response.
@@ -109,12 +110,14 @@ def create_xml_document(settings, request_id = nil, logout_message = nil)
109110 response_doc = XMLSecurity ::Document . new
110111 response_doc . uuid = uuid
111112
113+ destination = settings . idp_slo_response_service_url || settings . idp_slo_target_url
114+
112115 root = response_doc . add_element 'samlp:LogoutResponse' , { 'xmlns:samlp' => 'urn:oasis:names:tc:SAML:2.0:protocol' , "xmlns:saml" => "urn:oasis:names:tc:SAML:2.0:assertion" }
113116 root . attributes [ 'ID' ] = uuid
114117 root . attributes [ 'IssueInstant' ] = time
115118 root . attributes [ 'Version' ] = '2.0'
116119 root . attributes [ 'InResponseTo' ] = request_id unless request_id . nil?
117- root . attributes [ 'Destination' ] = settings . idp_slo_target_url unless settings . idp_slo_target_url . nil? or settings . idp_slo_target_url . empty?
120+ root . attributes [ 'Destination' ] = destination unless destination . nil? or destination . empty?
118121
119122 if settings . sp_entity_id != nil
120123 issuer = root . add_element "saml:Issuer"
0 commit comments