Return-Path: X-Original-To: apmail-deltacloud-dev-archive@www.apache.org Delivered-To: apmail-deltacloud-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DE8409D30 for ; Thu, 23 Feb 2012 13:55:28 +0000 (UTC) Received: (qmail 84172 invoked by uid 500); 23 Feb 2012 13:55:28 -0000 Delivered-To: apmail-deltacloud-dev-archive@deltacloud.apache.org Received: (qmail 84155 invoked by uid 500); 23 Feb 2012 13:55:28 -0000 Mailing-List: contact dev-help@deltacloud.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@deltacloud.apache.org Delivered-To: mailing list dev@deltacloud.apache.org Received: (qmail 84147 invoked by uid 99); 23 Feb 2012 13:55:28 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Feb 2012 13:55:28 +0000 X-ASF-Spam-Status: No, hits=-5.0 required=5.0 tests=RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of mfojtik@redhat.com designates 209.132.183.28 as permitted sender) Received: from [209.132.183.28] (HELO mx1.redhat.com) (209.132.183.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Feb 2012 13:55:21 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q1NDsxaS020461 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 23 Feb 2012 08:55:00 -0500 Received: from dhcp-29-121.brq.redhat.com (dhcp-29-121.brq.redhat.com [10.34.29.121]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q1NDsqJO001256 for ; Thu, 23 Feb 2012 08:54:59 -0500 From: mfojtik@redhat.com To: dev@deltacloud.apache.org Subject: [PATCH core 5/7] CIMI: Client LazyAuth should provide driver and provider informations Date: Thu, 23 Feb 2012 14:56:01 +0100 Message-Id: <1330005363-33589-5-git-send-email-mfojtik@redhat.com> In-Reply-To: <1330005363-33589-1-git-send-email-mfojtik@redhat.com> References: <1330005363-33589-1-git-send-email-mfojtik@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Virus-Checked: Checked by ClamAV on apache.org From: Michal Fojtik 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 --- 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