Skip to content

Commit 9186660

Browse files
author
Jacob Klapwijk
committed
Use idp_slo_service_url instead of idp_slo_target_url in LogoutRequest
1 parent 5a27c4c commit 9186660

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

lib/onelogin/ruby-saml/logoutrequest.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ def request_id
3232
#
3333
def create(settings, params={})
3434
params = create_params(settings, params)
35-
params_prefix = (settings.idp_slo_target_url =~ /\?/) ? '&' : '?'
35+
params_prefix = (settings.idp_slo_service_url =~ /\?/) ? '&' : '?'
3636
saml_request = CGI.escape(params.delete("SAMLRequest"))
3737
request_params = "#{params_prefix}SAMLRequest=#{saml_request}"
3838
params.each_pair do |key, value|
3939
request_params << "&#{key.to_s}=#{CGI.escape(value.to_s)}"
4040
end
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 + request_params
41+
raise SettingError.new "Invalid settings, idp_slo_service_url is not set!" if settings.idp_slo_service_url.nil? or settings.idp_slo_service_url.empty?
42+
@logout_url = settings.idp_slo_service_url + request_params
4343
end
4444

4545
# Creates the Get parameters for the logout request.
@@ -109,7 +109,7 @@ def create_xml_document(settings)
109109
root.attributes['ID'] = uuid
110110
root.attributes['IssueInstant'] = time
111111
root.attributes['Version'] = "2.0"
112-
root.attributes['Destination'] = settings.idp_slo_target_url unless settings.idp_slo_target_url.nil? or settings.idp_slo_target_url.empty?
112+
root.attributes['Destination'] = settings.idp_slo_service_url unless settings.idp_slo_service_url.nil? or settings.idp_slo_service_url.empty?
113113

114114
if settings.sp_entity_id
115115
issuer = root.add_element "saml:Issuer"

test/logoutrequest_test.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class RequestTest < Minitest::Test
88
let(:settings) { OneLogin::RubySaml::Settings.new }
99

1010
before do
11-
settings.idp_slo_target_url = "http://unauth.com/logout"
11+
settings.idp_slo_service_url = "http://unauth.com/logout"
1212
settings.name_identifier_value = "f00f00"
1313
end
1414

@@ -43,7 +43,7 @@ class RequestTest < Minitest::Test
4343
end
4444

4545
it "set sessionindex" do
46-
settings.idp_slo_target_url = "http://example.com"
46+
settings.idp_slo_service_url = "http://example.com"
4747
sessionidx = OneLogin::RubySaml::Utils.uuid
4848
settings.sessionindex = sessionidx
4949

@@ -75,7 +75,7 @@ class RequestTest < Minitest::Test
7575

7676
describe "when the target url contains a query string" do
7777
it "create the SAMLRequest parameter correctly" do
78-
settings.idp_slo_target_url = "http://example.com?field=value"
78+
settings.idp_slo_service_url = "http://example.com?field=value"
7979

8080
unauth_url = OneLogin::RubySaml::Logoutrequest.new.create(settings)
8181
assert_match /^http:\/\/example.com\?field=value&SAMLRequest/, unauth_url
@@ -84,7 +84,7 @@ class RequestTest < Minitest::Test
8484

8585
describe "consumation of logout may need to track the transaction" do
8686
it "have access to the request uuid" do
87-
settings.idp_slo_target_url = "http://example.com?field=value"
87+
settings.idp_slo_service_url = "http://example.com?field=value"
8888

8989
unauth_req = OneLogin::RubySaml::Logoutrequest.new
9090
unauth_url = unauth_req.create(settings)

0 commit comments

Comments
 (0)