Skip to content

Commit 1556994

Browse files
authored
Merge pull request #454 from mberlanda/feat/whitelist-response-options
Added Response available options list
2 parents b69d513 + fb17e8a commit 1556994

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

lib/onelogin/ruby-saml/response.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@ class Response < SamlMessage
3030

3131
attr_accessor :soft
3232

33+
# Response available options
34+
# This is not a whitelist to allow people extending OneLogin::RubySaml:Response
35+
# and pass custom options
36+
AVAILABLE_OPTIONS = [
37+
:allowed_clock_drift, :check_duplicated_attributes, :matches_request_id, :settings, :skip_authnstatement, :skip_conditions,
38+
:skip_destination, :skip_recipient_check, :skip_subject_confirmation
39+
]
40+
# TODO: Update the comment on initialize to describe every option
41+
3342
# Constructs the SAML Response. A Response Object that is an extension of the SamlMessage class.
3443
# @param response [String] A UUEncoded SAML response from the IdP.
3544
# @param options [Hash] :settings to provide the OneLogin::RubySaml::Settings object

test/response_test.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ class RubySamlTest < Minitest::Test
6060
assert_raises(ArgumentError) { OneLogin::RubySaml::Response.new(nil) }
6161
end
6262

63+
it "not filter available options only" do
64+
options = { :skip_destination => true, :foo => :bar }
65+
response = OneLogin::RubySaml::Response.new(response_document_valid_signed, options)
66+
assert_includes response.options.keys, :skip_destination
67+
assert_includes response.options.keys, :foo
68+
end
69+
6370
it "be able to parse a document which contains ampersands" do
6471
XMLSecurity::SignedDocument.any_instance.stubs(:digests_match?).returns(true)
6572
OneLogin::RubySaml::Response.any_instance.stubs(:validate_conditions).returns(true)

0 commit comments

Comments
 (0)