Skip to content

Commit 5a450a2

Browse files
authored
Merge pull request #632 from onelogin/minor_test_fix
Make the uuid editable and make a minor test fix
2 parents b843467 + 6403892 commit 5a450a2

File tree

7 files changed

+38
-5
lines changed

7 files changed

+38
-5
lines changed

lib/onelogin/ruby-saml/authrequest.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module RubySaml
1515
class Authrequest < SamlMessage
1616

1717
# AuthNRequest ID
18-
attr_reader :uuid
18+
attr_accessor :uuid
1919

2020
# Initializes the AuthNRequest. An Authrequest Object that is an extension of the SamlMessage class.
2121
# Asigns an ID, a random uuid.

lib/onelogin/ruby-saml/logoutrequest.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module RubySaml
1212
class Logoutrequest < SamlMessage
1313

1414
# Logout Request ID
15-
attr_reader :uuid
15+
attr_accessor :uuid
1616

1717
# Initializes the Logout Request. A Logoutrequest Object that is an extension of the SamlMessage class.
1818
# Asigns an ID, a random uuid.

lib/onelogin/ruby-saml/slo_logoutresponse.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module RubySaml
1313
class SloLogoutresponse < SamlMessage
1414

1515
# Logout Response ID
16-
attr_reader :uuid
16+
attr_accessor :uuid
1717

1818
# Initializes the Logout Response. A SloLogoutresponse Object that is an extension of the SamlMessage class.
1919
# Asigns an ID, a random uuid.

test/logoutrequest_test.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,5 +308,16 @@ class RequestTest < Minitest::Test
308308
assert cert.public_key.verify(signature_algorithm.new, Base64.decode64(params['Signature']), query_string)
309309
end
310310
end
311+
312+
describe "#manipulate request_id" do
313+
it "be able to modify the request id" do
314+
logoutrequest = OneLogin::RubySaml::Logoutrequest.new
315+
request_id = logoutrequest.request_id
316+
assert_equal request_id, logoutrequest.uuid
317+
logoutrequest.uuid = "new_uuid"
318+
assert_equal logoutrequest.request_id, logoutrequest.uuid
319+
assert_equal "new_uuid", logoutrequest.request_id
320+
end
321+
end
311322
end
312323
end

test/request_test.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,5 +388,16 @@ class RequestTest < Minitest::Test
388388
assert cert.public_key.verify(signature_algorithm.new, Base64.decode64(params['Signature']), query_string)
389389
end
390390
end
391+
392+
describe "#manipulate request_id" do
393+
it "be able to modify the request id" do
394+
authnrequest = OneLogin::RubySaml::Authrequest.new
395+
request_id = authnrequest.request_id
396+
assert_equal request_id, authnrequest.uuid
397+
authnrequest.uuid = "new_uuid"
398+
assert_equal authnrequest.request_id, authnrequest.uuid
399+
assert_equal "new_uuid", authnrequest.request_id
400+
end
401+
end
391402
end
392403
end

test/saml_message_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class RubySamlTest < Minitest::Test
7272

7373
describe 'with a custom setting for message_max_bytesize' do
7474
let(:message_max_bytesize) { 100_00 }
75-
let(:settings) { OneLogin::RubySaml::Settings.new(message_max_bytesize: message_max_bytesize) }
75+
let(:settings) { OneLogin::RubySaml::Settings.new({:message_max_bytesize => message_max_bytesize}) }
7676

7777
it 'uses the custom setting' do
7878
assert_raises(OneLogin::RubySaml::ValidationError, "Encoded SAML Message exceeds #{message_max_bytesize} bytes, so was rejected") do
@@ -83,4 +83,4 @@ class RubySamlTest < Minitest::Test
8383
end
8484
end
8585
end
86-
end
86+
end

test/slo_logoutresponse_test.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,5 +309,16 @@ class SloLogoutresponseTest < Minitest::Test
309309
assert cert.public_key.verify(signature_algorithm.new, Base64.decode64(params['Signature']), query_string)
310310
end
311311
end
312+
313+
describe "#manipulate response_id" do
314+
it "be able to modify the response id" do
315+
logoutresponse = OneLogin::RubySaml::SloLogoutresponse.new
316+
response_id = logoutresponse.response_id
317+
assert_equal response_id, logoutresponse.uuid
318+
logoutresponse.uuid = "new_uuid"
319+
assert_equal logoutresponse.response_id, logoutresponse.uuid
320+
assert_equal "new_uuid", logoutresponse.response_id
321+
end
322+
end
312323
end
313324
end

0 commit comments

Comments
 (0)