-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feat] Collect request validation errors (#18)
* wip add error collector * Fix type and rewrite request with proper validation test cases * Lead error render decision to gem user * Validate the certificate's existence before verifying the signature. --------- Co-authored-by: zogoo <[email protected]>
- Loading branch information
Showing
4 changed files
with
187 additions
and
294 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,16 +81,6 @@ def params | |
expect(response.is_valid?).to be_truthy | ||
end | ||
|
||
it "should create a SAML Logout Response" do | ||
params[:SAMLRequest] = make_saml_logout_request | ||
expect(validate_saml_request).to eq(true) | ||
expect(saml_request.logout_request?).to eq true | ||
saml_response = encode_response(principal) | ||
response = OneLogin::RubySaml::Logoutresponse.new(saml_response, saml_settings) | ||
expect(response.validate).to eq(true) | ||
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) | ||
|
@@ -138,5 +128,18 @@ def params | |
it 'should successfully validate signature' do | ||
expect(validate_saml_request).to eq(true) | ||
end | ||
|
||
context "solicited Response" do | ||
let(:principal) { double email_address: "[email protected]" } | ||
|
||
it "should create a SAML Logout Response" do | ||
expect(validate_saml_request).to eq(true) | ||
expect(saml_request.logout_request?).to eq true | ||
saml_response = encode_response(principal) | ||
response = OneLogin::RubySaml::Logoutresponse.new(saml_response, saml_settings) | ||
expect(response.validate).to eq(true) | ||
expect(response.issuer).to eq("http://idp.com/saml/idp") | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.