@@ -66,7 +66,7 @@ def request_phase
6666 # If credentials were POSTed directly to /auth/:provider, redirect to the callback path.
6767 # This mirrors the behavior of many OmniAuth providers and allows test helpers (like
6868 # OmniAuth::Test::PhonySession) to populate `env['omniauth.auth']` on the callback request.
69- if request . post? && request . params [ "username" ] . to_s != "" && request . params [ "password" ] . to_s != ""
69+ if request . post? && request_data [ "username" ] . to_s != "" && request_data [ "password" ] . to_s != ""
7070 return Rack ::Response . new ( [ ] , 302 , "Location" => callback_url ) . finish
7171 end
7272
@@ -100,12 +100,12 @@ def callback_phase
100100
101101 return fail! ( :missing_credentials ) if missing_credentials?
102102 begin
103- @ldap_user_info = @adaptor . bind_as ( filter : filter ( @adaptor ) , size : 1 , password : request . params [ "password" ] )
103+ @ldap_user_info = @adaptor . bind_as ( filter : filter ( @adaptor ) , size : 1 , password : request_data [ "password" ] )
104104
105105 unless @ldap_user_info
106106 # Attach password policy info to env if available (best-effort)
107107 attach_password_policy_env ( @adaptor )
108- return fail! ( :invalid_credentials , InvalidCredentialsError . new ( "Invalid credentials for #{ request . params [ "username" ] } " ) )
108+ return fail! ( :invalid_credentials , InvalidCredentialsError . new ( "Invalid credentials for #{ request_data [ "username" ] } " ) )
109109 end
110110
111111 # Optionally attach policy info even on success (e.g., timeBeforeExpiration)
@@ -121,10 +121,10 @@ def callback_phase
121121 def filter ( adaptor , username_override = nil )
122122 flt = adaptor . filter
123123 if flt && !flt . to_s . empty?
124- username = Net ::LDAP ::Filter . escape ( @options [ :name_proc ] . call ( username_override || request . params [ "username" ] ) )
124+ username = Net ::LDAP ::Filter . escape ( @options [ :name_proc ] . call ( username_override || request_data [ "username" ] ) )
125125 Net ::LDAP ::Filter . construct ( flt % { username : username } )
126126 else
127- Net ::LDAP ::Filter . equals ( adaptor . uid , @options [ :name_proc ] . call ( username_override || request . params [ "username" ] ) )
127+ Net ::LDAP ::Filter . equals ( adaptor . uid , @options [ :name_proc ] . call ( username_override || request_data [ "username" ] ) )
128128 end
129129 end
130130
@@ -182,7 +182,11 @@ def valid_request_method?
182182 end
183183
184184 def missing_credentials?
185- request . params [ "username" ] . nil? || request . params [ "username" ] . empty? || request . params [ "password" ] . nil? || request . params [ "password" ] . empty?
185+ request_data [ "username" ] . nil? || request_data [ "username" ] . empty? || request_data [ "password" ] . nil? || request_data [ "password" ] . empty?
186+ end
187+
188+ def request_data
189+ @env [ 'action_dispatch.request.request_parameters' ] || request . params
186190 end
187191
188192 # Extract a normalized username from a trusted header when enabled.
0 commit comments