Skip to content

Commit eae5319

Browse files
authored
DEV: uses valid SAML and not a string for specs (#138)
The string we were using before is just invalid XML and will explode on latest versions of REXML, what we want to test here is just minimum valid SAML.
1 parent 38b8203 commit eae5319

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

spec/integration/saml_cross_site_spec.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@
33
require "rails_helper"
44

55
describe "SAML cross-site with same-site cookie", type: :request do
6+
let(:saml_response) do
7+
Base64.strict_encode64("<Response xmlns='urn:oasis:names:tc:SAML:2.0:protocol'/>")
8+
end
9+
610
before do
711
OmniAuth.config.test_mode = false
812
global_setting :saml_target_url, "https://example.com/samlidp"
913
end
1014

1115
it "serves an auto-submitting POST form" do
12-
post "/auth/saml/callback", params: { "SAMLResponse" => "somesamldata" }
16+
post "/auth/saml/callback", params: { "SAMLResponse" => saml_response }
1317
expect(response.status).to eq(200)
1418
expect(response.body).to have_tag(
1519
"form",
@@ -23,7 +27,7 @@
2327
"form input",
2428
with: {
2529
"name" => "SAMLResponse",
26-
"value" => "somesamldata",
30+
"value" => saml_response,
2731
"type" => "hidden",
2832
},
2933
)
@@ -43,7 +47,7 @@
4347
end
4448

4549
it "continues once the samesite form has been submitted" do
46-
post "/auth/saml/callback", params: { "SAMLResponse" => "somesamldata", "SameSite" => "1" }
50+
post "/auth/saml/callback", params: { "SAMLResponse" => saml_response, "SameSite" => "1" }
4751
expect(response.status).to eq(302)
4852
expect(response.location).to eq("/auth/failure?message=invalid_ticket&strategy=saml")
4953
end

0 commit comments

Comments
 (0)