Skip to content

Commit 41cf1ff

Browse files
author
Jon Phenow
committed
run through some test
1 parent 4f1545c commit 41cf1ff

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

lib/saml_idp/request.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def valid?
105105
return false
106106
end
107107

108-
if !acceptable_acs_hosts.include?(acs_host)
108+
if !acceptable_reponse_hosts.include?(response_host)
109109
log "No acceptable AssertionConsumerServiceURL, either configure them via config.assertion_consumer_service_hosts or match to your metadata_url host"
110110
return false
111111
end
@@ -141,19 +141,19 @@ def session_index
141141
@_session_index ||= xpath("//samlp:SessionIndex", samlp: samlp).first.try(:content)
142142
end
143143

144-
def acceptable_acs_hosts
145-
(config.assertion_consumer_service_hosts || []) +
146-
service_provider.metdata_url_host ? [service_provider.metdata_url_host] : []
144+
def acceptable_reponse_hosts
145+
Array(config.assertion_consumer_service_hosts) +
146+
(service_provider.metadata_url_host ? [service_provider.metadata_url_host] : [])
147147
end
148-
private :acceptable_acs_hosts
148+
private :acceptable_reponse_hosts
149149

150-
def acs_host
151-
uri = URI(acs_url)
150+
def response_host
151+
uri = URI(response_url)
152152
if uri
153153
uri.host
154154
end
155155
end
156-
private :acs_host
156+
private :response_host
157157

158158
def document
159159
@_document ||= Saml::XML::Document.parse(raw_xml)

spec/acceptance/idp_controller_spec.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
scenario 'Login via default signup page' do
55
saml_request = make_saml_request("http://foo.example.com/saml/consume")
66
visit "/saml/auth?SAMLRequest=#{CGI.escape(saml_request)}"
7-
fill_in 'Email', :with => "foo@example.com"
8-
fill_in 'Password', :with => "okidoki"
7+
expect(status_code).to eq(200)
8+
fill_in 'email', :with => "foo@example.com"
9+
fill_in 'password', :with => "okidoki"
910
click_button 'Sign in'
1011
click_button 'Submit' # simulating onload
1112
expect(current_url).to eq('http://foo.example.com/saml/consume')

spec/spec_helper.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
config.before do
3131
SamlIdp.configure do |c|
32+
c.assertion_consumer_service_hosts = ["foo.example.com"]
3233
c.attributes = {
3334
emailAddress: {
3435
name: "email-address",
@@ -45,5 +46,6 @@
4546
end
4647
end
4748

49+
SamlIdp::Default::SERVICE_PROVIDER[:metadata_url] = 'https://example.com/meta'
4850
SamlIdp::Default::SERVICE_PROVIDER[:assertion_consumer_logout_service_url] = 'https://foo.example.com/saml/logout'
4951
Capybara.default_host = "https://app.example.com"

0 commit comments

Comments
 (0)