Skip to content

Commit 3430749

Browse files
angelkbrownpboling
authored andcommitted
changing callback_path to callback_url to take into account relative root url
1 parent 0ad4532 commit 3430749

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/omniauth/strategies/ldap.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,18 @@ def request_phase
5757
# Fast-path: if a trusted identity header is present, skip the login form
5858
# and jump to the callback where we will complete using directory lookup.
5959
if header_username
60-
return Rack::Response.new([], 302, "Location" => callback_path).finish
60+
return Rack::Response.new([], 302, "Location" => callback_url).finish
6161
end
6262

6363
# If credentials were POSTed directly to /auth/:provider, redirect to the callback path.
6464
# This mirrors the behavior of many OmniAuth providers and allows test helpers (like
6565
# OmniAuth::Test::PhonySession) to populate `env['omniauth.auth']` on the callback request.
6666
if request.post? && request.params["username"].to_s != "" && request.params["password"].to_s != ""
67-
return Rack::Response.new([], 302, "Location" => callback_path).finish
67+
return Rack::Response.new([], 302, "Location" => callback_url).finish
6868
end
6969

7070
OmniAuth::LDAP::Adaptor.validate(@options)
71-
f = OmniAuth::Form.new(title: options[:title] || "LDAP Authentication", url: callback_path)
71+
f = OmniAuth::Form.new(title: options[:title] || "LDAP Authentication", url: callback_url)
7272
f.text_field("Login", "username")
7373
f.password_field("Password", "password")
7474
f.button("Sign In")

spec/omniauth/strategies/ldap_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def make_env(path = "/auth/ldap", props = {})
7070
end
7171

7272
it "has the callback as the action for the form" do
73-
expect(last_response.body).to include("action='/auth/ldap/callback'")
73+
expect(last_response.body).to include("action='http://example.org/auth/ldap/callback'")
7474
end
7575

7676
it "has a text field for each of the fields" do

0 commit comments

Comments
 (0)