-
Notifications
You must be signed in to change notification settings - Fork 166
Add the SAML remote logout endpoint to the metadata #5709
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -111,7 +111,7 @@ | |
| result = { service_provider: nil, saml_request_valid: false } | ||
| expect(@analytics).to receive(:track_event).with('Remote Logout initiated', result) | ||
|
|
||
| delete :remotelogout, params: { SAMLRequest: 'foo' } | ||
| post :remotelogout, params: { SAMLRequest: 'foo' } | ||
|
||
| end | ||
|
|
||
| let(:agency) { create(:agency) } | ||
|
|
@@ -240,7 +240,7 @@ | |
| ), | ||
| ).to eq(true) | ||
|
|
||
| delete :remotelogout, params: payload.to_h.merge(Signature: Base64.encode64(signature)) | ||
| post :remotelogout, params: payload.to_h.merge(Signature: Base64.encode64(signature)) | ||
|
|
||
| expect(response).to be_ok | ||
| expect(session_accessor.load).to be_empty | ||
|
|
@@ -277,7 +277,7 @@ | |
| ), | ||
| ).to eq(true) | ||
|
|
||
| delete :remotelogout, params: payload.to_h.merge(Signature: Base64.encode64(signature)) | ||
| post :remotelogout, params: payload.to_h.merge(Signature: Base64.encode64(signature)) | ||
|
|
||
| expect(response).to be_bad_request | ||
| end | ||
|
|
@@ -308,7 +308,7 @@ | |
| ), | ||
| ).to eq(true) | ||
|
|
||
| delete :remotelogout, params: payload.to_h.merge(Signature: Base64.encode64(signature)) | ||
| post :remotelogout, params: payload.to_h.merge(Signature: Base64.encode64(signature)) | ||
|
|
||
| expect(response).to be_bad_request | ||
| end | ||
|
|
@@ -339,13 +339,13 @@ | |
| ), | ||
| ).to eq(true) | ||
|
|
||
| delete :remotelogout, params: payload.to_h.merge(Signature: Base64.encode64(signature)) | ||
| post :remotelogout, params: payload.to_h.merge(Signature: Base64.encode64(signature)) | ||
|
|
||
| expect(response).to be_bad_request | ||
| end | ||
|
|
||
| it 'rejects requests from a wrong cert' do | ||
| delete :remotelogout, params: UriService.params( | ||
| post :remotelogout, params: UriService.params( | ||
| OneLogin::RubySaml::Logoutrequest.new.create(wrong_cert_settings), | ||
| ) | ||
|
|
||
|
|
||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| require 'rails_helper' | ||
|
||
|
|
||
| RSpec.describe 'SAML requests', type: :request do | ||
| include SamlAuthHelper | ||
|
|
||
| describe 'POST /api/saml/auth' do | ||
| let(:cookie_regex) { /\A(?<cookie>\w+)=/ } | ||
|
|
||
| it 'does not set a session cookie' do | ||
| post saml_settings.idp_sso_target_url | ||
| new_cookies = response.header['Set-Cookie'].split("\n").map do |c| | ||
| cookie_regex.match(c)[:cookie] | ||
| end | ||
|
|
||
| expect(new_cookies).not_to include('_upaya_session') | ||
| end | ||
| end | ||
|
|
||
| describe '/api/saml/remotelogout' do | ||
| let(:remote_slo_url) do | ||
| saml_settings.idp_slo_target_url.gsub('logout', 'remotelogout') | ||
| end | ||
|
|
||
| it 'does not accept GET requests' do | ||
| get remote_slo_url | ||
| expect(response.status).to eq(404) | ||
| end | ||
|
|
||
| it 'does not accept DELETE requests' do | ||
| delete remote_slo_url | ||
| expect(response.status).to eq(404) | ||
| end | ||
|
|
||
| it 'accepts POST requests' do | ||
| post remote_slo_url | ||
| # fails (:bad_request) without SAMLRequest param but not 404 | ||
| expect(response.status).to eq(400) | ||
| end | ||
| end | ||
| end | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the other actions since we really only support the POST binding and not the Redirect binding.