Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug Fix: SAML Response Initialize Arguments Passed in the Wrong Order #198

Merged
merged 2 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/saml_idp/controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ def encode_authn_response(principal, opts = {})
session_expiry,
name_id_formats_opts,
asserted_attributes_opts,
signed_assertion_opts,
signed_message_opts,
signed_assertion_opts,
compress_opts
).build
end
Expand Down
6 changes: 6 additions & 0 deletions spec/lib/saml_idp/controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ def params
expect(response.issuer).to eq("http://example.com")
end

it "should by default create a SAML Response with a signed assertion" do
saml_response = encode_response(principal)
response = OneLogin::RubySaml::Response.new(saml_response)
response.settings = saml_settings("https://foo.example.com/saml/consume", true)
expect(response.is_valid?).to be_truthy
end

[:sha1, :sha256, :sha384, :sha512].each do |algorithm_name|
it "should create a SAML Response using the #{algorithm_name} algorithm" do
Expand Down
4 changes: 3 additions & 1 deletion spec/support/saml_request_macros.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ def add_securty_options(settings, authn_requests_signed: true,
logout_requests_signed: true,
logout_responses_signed: true,
digest_method: XMLSecurity::Document::SHA256,
signature_method: XMLSecurity::Document::RSA_SHA256)
signature_method: XMLSecurity::Document::RSA_SHA256,
assertions_signed: true)
# Security section
settings.idp_cert = SamlIdp::Default::X509_CERTIFICATE
# Signed embedded singature
Expand All @@ -51,6 +52,7 @@ def add_securty_options(settings, authn_requests_signed: true,
settings.security[:metadata_signed] = digest_method
settings.security[:digest_method] = digest_method
settings.security[:signature_method] = signature_method
settings.security[:want_assertions_signed] = assertions_signed
settings.private_key = sp_pv_key
settings.certificate = sp_x509_cert
end
Expand Down
Loading