angelazno / google-gdata

Automatically exported from code.google.com/p/google-gdata
0 stars 0 forks source link

Utilties.QueryClientLoginToken #481

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
The Proxy that can be passed to RequestFactory of DocumentsService
is not being passed while making Utilties.QueryClientLoginToken, where
a HttpWebRequest is being created for Google Authentication URI.
It may not be an issue when the client application is running as
logged on user identity which it typically does for .Net Console,
Windows Forms application, infact a ASP.NET WebPage may also work,
However when used  n a ASP.NET Web Service it requires the Proxy to be
expilictly passed. With the current SDK QueryClientLoginToken is
hanging because it is not able to use the system default proxy and
connect to Google Authentication URI.

I just saw another post about the same issue, however as per the e-mail I have 
received from groups,.. submitting the bug, and proposed fix in the attached MS 
Word Document.

Original issue reported on code.google.com by j.chandr...@tcs.com on 25 Feb 2011 at 2:32

Attachments:

GoogleCodeExporter commented 8 years ago
PASTING THE CONTENTS OF THE DOCX FILE HERE:

What steps will reproduce the problem?

Create a new ASP.NET WebService by creating a Web Method with below block of 
code 
to verify  the login successful and retrieve authentication token
[WebMethod]
public string GetAuthToken()
{
DocumentsService gDOCService = new DocumentsService("SOMEAPP");
gDOCService.setUserCredentials("abcd@somedomain.com", "somepassword");
((GDataGAuthRequestFactory)gDOCService.RequestFactory).Proxy = 
new WebProxy("12.18.0.17", 8080);
string authToken = gDOCService.QueryClientLoginToken();
return authToken;
}
This may hang and eventually timeout, especially in case of asp.net web service.
Proposed Fix: Step 1
Source File core\gauthrequest.cs
Method  internal string QueryAuthToken(GDataCredentials  gc)

 The return call should be modified to pass a proxy from the request factory 
return Utilities.QueryClientLoginToken(gdc,
this.factory.Service, 
this.factory.ApplicationName,                                     
this.factory.KeepAlive,
this.factory.Proxy,<- New parameter
authHandler);
Proposed Fix: Step 2
Source File core\utilities.cs
Method  public static string QueryClientLoginToken

public static string QueryClientLoginToken(
GDataCredentials gc, 
                                    string serviceName,
                                    string applicationName, 
                                    bool fUseKeepAlive,
IWebProxy proxyServer,<- New arameter
                                    Uri clientLoginHandler
                            )
………………………
HttpWebRequest authRequest = WebRequest.Create(clientLoginHandler)
 as HttpWebRequest; 
            authRequest.KeepAlive = fUseKeepAlive;
            authRequest.Proxy = proxyServer;//assign the proxySerer
…………………………..

Original comment by ccherub...@google.com on 25 Feb 2011 at 7:18

GoogleCodeExporter commented 8 years ago
Can you please send a patch file for the proposed fix?
You can generate it by updating your source tree and then calling "svn diff".

Original comment by ccherub...@google.com on 25 Feb 2011 at 7:19

GoogleCodeExporter commented 8 years ago
Suggestion: instead of changing the actual QueryClientLoginToken method, 
consider to add another signature to QueryClientLoginToken with one more 
parameter: the web proxy. 
See attached diff file.

Original comment by fht...@gmail.com on 27 Feb 2011 at 8:38

Attachments:

GoogleCodeExporter commented 8 years ago
I agree, infact thats the way I added the method overloads in my actual project.

I request the attached proxy.diff file can be taken to proceed with 
implementation of the fix.
I am sorry, I am little unfamiliar with using the actual source tree and it 
might delay this process if I need to generate this. 

Original comment by j.chandr...@tcs.com on 28 Feb 2011 at 7:08

GoogleCodeExporter commented 8 years ago
Patch committed in rev. 1073

Thanks everyone!

Original comment by ccherub...@google.com on 3 Mar 2011 at 4:02

GoogleCodeExporter commented 8 years ago
Issue 371 has been merged into this issue.

Original comment by ccherub...@google.com on 8 Mar 2011 at 2:36

GoogleCodeExporter commented 8 years ago
When will the next build be made for the client library, with this change?
I really need this. 

Original comment by chris.go...@gmail.com on 11 Apr 2011 at 10:27

GoogleCodeExporter commented 8 years ago
If you need it urgently, I'd recommend checking out the source as explained at 
http://code.google.com/p/google-gdata/source/checkout and building it to 
generate the updated dlls.

Original comment by ccherub...@google.com on 11 Apr 2011 at 10:30