You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by mf...@redhat.com on 2012/02/23 14:56:01 UTC
[PATCH core 5/7] CIMI: Client LazyAuth should provide driver and provider informations
From: Michal Fojtik <mf...@redhat.com>
This patch will make LazyAuth able to store and report driver
and provider in addition to user and password.
Also LazyAuth will try to read username and password from session
then fallback to Basic HTTP Auth.
Signed-off-by: Michal fojtik <mf...@redhat.com>
---
clients/cimi/lib/lazy_auth.rb | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/clients/cimi/lib/lazy_auth.rb b/clients/cimi/lib/lazy_auth.rb
index 528f95c..1d4bf14 100644
--- a/clients/cimi/lib/lazy_auth.rb
+++ b/clients/cimi/lib/lazy_auth.rb
@@ -36,10 +36,20 @@ module Sinatra
@password
end
+ def provider
+ credentials!
+ @provider
+ end
+
def provided?
@provided
end
+ def driver
+ credentials!
+ @driver
+ end
+
def credentials!
if ENV["API_USER"] && ENV["API_PASSWORD"]
@user = ENV["API_USER"]
@@ -51,8 +61,10 @@ module Sinatra
unless auth.provided? && auth.basic? && auth.credentials
@app.authorize!
end
- @user = auth.credentials[0]
- @password = auth.credentials[1]
+ @user = @app.session[:username] || auth.credentials[0]
+ @password = @app.session[:password] || auth.credentials[1]
+ @provider = @app.session[:provider]
+ @driver = @app.session[:driver]
@provided = true
end
end
--
1.7.9.1