[katello-devel] [PATCH katello] Switching oauth warden strategy to use request.headers
Chris Alfonso
calfonso at redhat.com
Thu Aug 2 16:50:18 UTC 2012
request.env doesn't have the HTTP_KATELLO_USER set as
header from the client. Since request is from ActionDispatch,
the header names are converted from '-' to '_'.
---
src/config/initializers/warden.rb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/config/initializers/warden.rb b/src/config/initializers/warden.rb
index 6924f7c..3508cca 100644
--- a/src/config/initializers/warden.rb
+++ b/src/config/initializers/warden.rb
@@ -141,7 +141,7 @@ Warden::Strategies.add(:oauth) do
end
def authenticate!
- return fail("no 'katello-user' header") if request.env['HTTP_KATELLO_USER'].blank?
+ return fail("no 'katello-user' header") if request.headers['HTTP_KATELLO_USER'].blank?
consumer_key = OAuth::RequestProxy.proxy(request).oauth_consumer_key
signature=OAuth::Signature.build(request) do
@@ -150,7 +150,7 @@ Warden::Strategies.add(:oauth) do
return fail!("Invalid oauth signature") unless signature.verify
- u = User.where(:username => request.env['HTTP_KATELLO_USER']).first
+ u = User.where(:username => request.headers['HTTP_KATELLO_USER']).first
u ? success!(u, "OAuth") : fail!("Username is not correct - could not log in")
rescue OAuth::Signature::UnknownSignatureMethod => e
Rails.logger.error "Unknown oauth signature method"+ e.to_s
--
1.7.11.2
More information about the katello-devel
mailing list