-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
**Why**: Better UX, since we end up on dashboard site, where user clicked the Sign Out button.
- Loading branch information
Peter Karman
committed
Jul 18, 2016
1 parent
73b8d4f
commit c6d3285
Showing
10 changed files
with
149 additions
and
42 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
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class UuiDtoString < ActiveRecord::Migration | ||
def change | ||
change_column :users, :uuid, :string, null: false | ||
end | ||
end |
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 |
---|---|---|
@@ -1,15 +1,67 @@ | ||
require 'rails_helper' | ||
|
||
describe 'SLO' do | ||
it 'uses external SAML IdP' do | ||
# ask the IdP to initiate a SLO | ||
idp_uri = URI(ENV['IDP_SLO_URL']) | ||
saml_idp_resp = Net::HTTP.get(idp_uri) | ||
describe 'IdP-initiated' do | ||
it 'uses external SAML IdP' do | ||
# ask the IdP to initiate a SLO | ||
idp_uri = URI(ENV['IDP_SLO_URL']) | ||
saml_idp_resp = Net::HTTP.get(idp_uri) | ||
|
||
# send the SAMLRequest to our logout endpoint | ||
post '/users/auth/saml/logout', SAMLRequest: saml_idp_resp, RelayState: 'the_idp_session_id' | ||
# send the SAMLRequest to our logout endpoint | ||
post '/users/auth/saml/logout', SAMLRequest: saml_idp_resp, RelayState: 'the_idp_session_id' | ||
|
||
# redirect to complete the sign-out at the IdP | ||
expect(response).to redirect_to(%r{idp.example.com/saml/logout}) | ||
# redirect to complete the sign-out at the IdP | ||
expect(response).to redirect_to(%r{idp.example.com/saml/logout}) | ||
end | ||
|
||
it 'renders failure correctly' do | ||
idp_uri = URI(ENV['IDP_SLO_URL']) | ||
saml_idp_resp = Net::HTTP.get(idp_uri) | ||
|
||
# mangle the SAML payload a little to trigger error | ||
saml_idp_resp += 'foo' | ||
|
||
post '/users/auth/saml/logout', SAMLRequest: saml_idp_resp, RelayState: 'the_idp_session_id' | ||
|
||
expect(response.body).to match(/was not valid/) | ||
end | ||
end | ||
|
||
describe 'SP-initiated' do | ||
it 'uses external SAML IdP' do | ||
user = create(:user) | ||
login_as(user) | ||
|
||
# ask the SP to initiate a SLO | ||
get '/users/logout' | ||
|
||
expect(response).to redirect_to(%r{idp.example.com/saml/logout}) | ||
|
||
# send the SAMLRequest to IdP | ||
idp_uri = URI(response.headers['Location']) | ||
saml_idp_resp = Net::HTTP.get(idp_uri) | ||
|
||
# send the SAMLResponse back to our SP | ||
post '/users/auth/saml/logout', SAMLResponse: saml_idp_resp | ||
|
||
# expect we are logged out, on our site | ||
expect(response).to redirect_to(root_url) | ||
expect(flash[:notice]).to eq I18n.t('omniauth.logout_ok') | ||
end | ||
|
||
it 'renders failure correctly' do | ||
user = create(:user) | ||
login_as(user) | ||
|
||
get '/users/logout' | ||
idp_uri = URI(response.headers['Location']) | ||
saml_idp_resp = Net::HTTP.get(idp_uri) | ||
|
||
saml_idp_resp += 'foo' | ||
|
||
post '/users/auth/saml/logout', SAMLResponse: saml_idp_resp | ||
|
||
expect(response.body).to match(I18n.t('omniauth.logout_fail')) | ||
end | ||
end | ||
end |
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