Return-Path: Delivered-To: apmail-hc-dev-archive@www.apache.org Received: (qmail 45150 invoked from network); 9 Sep 2010 19:11:26 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 9 Sep 2010 19:11:26 -0000 Received: (qmail 14388 invoked by uid 500); 9 Sep 2010 19:11:26 -0000 Delivered-To: apmail-hc-dev-archive@hc.apache.org Received: (qmail 14327 invoked by uid 500); 9 Sep 2010 19:11:26 -0000 Mailing-List: contact dev-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpComponents Project" Delivered-To: mailing list dev@hc.apache.org Received: (qmail 14319 invoked by uid 99); 9 Sep 2010 19:11:26 -0000 Received: from Unknown (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Sep 2010 19:11:26 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of asankha.apache@gmail.com designates 209.85.212.179 as permitted sender) Received: from [209.85.212.179] (HELO mail-px0-f179.google.com) (209.85.212.179) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Sep 2010 19:11:03 +0000 Received: by pxi1 with SMTP id 1so913784pxi.10 for ; Thu, 09 Sep 2010 12:10:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=qpidd22HDBjQtbwAHCJ3TD72CT9K8+8uCBkmsrwTq7s=; b=QoPtHDrXHrIV/9i/epU9iyP4P6DVKYuRemJfp2oNDoVia2EYLNmu3vV//dBnSWbZr1 DdHaqtM+p3F7qYUL2/13JiFW9tQeixal9NSzavZ9YOngrLkitSLoy382yv+PsD7KvXYj eHc8WMA1/tItQjeldB6hdHlRBlJ/aeekaAfZE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; b=gXcmxpFeaP7ipYSDuRHv7UC5Llk0bo0aB+zALHwNvj6TFzYlvQWnjlpbdoVCXmfieT L6v+HfPnx+VE/dZzVeBv0Tx6xHcOta74m8yCQ7eGlXABtRwh8wLPPbBBT4RJXbEetedc O9oc9ag0VXuC9OYsDA/G961ZiynTVUtgaM3L0= Received: by 10.114.66.5 with SMTP id o5mr94371waa.219.1284059442482; Thu, 09 Sep 2010 12:10:42 -0700 (PDT) Received: from [192.168.1.3] ([112.135.136.154]) by mx.google.com with ESMTPS id k23sm2802129waf.17.2010.09.09.12.10.37 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 09 Sep 2010 12:10:39 -0700 (PDT) Sender: Asankha Perera Message-ID: <4C89312B.1060508@apache.org> Date: Fri, 10 Sep 2010 00:40:35 +0530 From: "Asankha C. Perera" User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100423 Thunderbird/3.0.4 MIME-Version: 1.0 To: HttpComponents Project Subject: Re: AuthScheme impl for OAuth References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Hi Tom > So I'm trying to implement an AuthScheme for OAuth (actually I'm trying to > augment SignPost to work with HttpClient's AuthScheme, but anyway...) > > The problem I'm running up against is when AuthScheme.authenticate( > Credentials, HttpRequest ) is called. The problem is, in order for the > request to be signed in OAuth, I need to know the entire request URI. The > HttpRequest that's passed into authenticate() only has the path portion of > the URI. > > Code snippet from OAuthScheme.java: > public Header authenticate( Credentials credentials, HttpRequest request > ) throws AuthenticationException { > System.out.println( "AuthScheme request: " + request.getURI() ); > // ... sign the request > } > > So, calling getURI on my original request shows: > http://twitter.com/statuses/update.xml > (get 401 response, authScheme handler kicks in...) > from the authenicate method, I get printed: > AuthScheme request: /statuses/update.xml > > I'm guessing this is because the request I'm getting is the 'new' request > created after the initial 401 response is returned. I know the HttpContext > holds state information between multiple requests (like redirects and 401s) > but I don't have access to that from my AuthScheme instance. So how can my > AuthScheme get the URI from the original request? > I think you are seeing the right request.. but you only see the request URI as your request went out that way. For example: GET http://twitter.com/statuses/update.xml HTTP/1.1 you issued, got translated as: GET /statuses/update.xml HTTP/1.1 Host: twitter.com You should still be able to get the scheme, method etc from the request, as well as the 'Host' header. Can you check if this is correct? cheers asankha -- Asankha C. Perera AdroitLogic, http://adroitlogic.org http://esbmagic.blogspot.com --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org For additional commands, e-mail: dev-help@hc.apache.org