Author: fmantek
Date: Thu Aug 23 03:20:14 2007
New Revision: 221
Modified:
trunk/clients/cs/RELEASE_NOTES.txt
trunk/clients/cs/samples/execrequest/main.cs
Log:
Enabled authsub use for ExecRequest tool
Modified: trunk/clients/cs/RELEASE_NOTES.txt
==============================================================================
--- trunk/clients/cs/RELEASE_NOTES.txt (original)
+++ trunk/clients/cs/RELEASE_NOTES.txt Thu Aug 23 03:20:14 2007
@@ -2,11 +2,11 @@
- Changed "adminUserName" to "adminEmailAddress" in AppsService so that it's
more clear what information is actually required for this parameter.
-
-== 1.1.0 ==
- added GZip support for .NET 1.1, 2.0 and .NET Compact Framework 2.0 (see
readme).
- fixed a Google Base issue (The server doesn't accept scientific notations
for floats)
- fixed typo in the blogger sample (www..blogger), which made the sample hard
to use
+- added the ability to use authsubtokens to the ExecRequest utility (including
exchange of a onetime
+ token to a session token). Just run ExecRequest for the command line
parameters
== 1.0.9.9 ==
- added GBase support for m:adjusted_name and gm:adjusted_value inside
attributes
Modified: trunk/clients/cs/samples/execrequest/main.cs
==============================================================================
--- trunk/clients/cs/samples/execrequest/main.cs (original)
+++ trunk/clients/cs/samples/execrequest/main.cs Thu Aug 23 03:20:14 2007
@@ -43,6 +43,10 @@
if (args.Length < 5)
{
Console.WriteLine("Not enough parameters. Usage is ExecRequest
<service> <cmd> <uri> <username> <password>, where cmd is QUERY, UPDATE,
INSERT, DELETE");
+ Console.WriteLine("or");
+ Console.WriteLine("ExecRequest <service> <cmd> <uri> /a
<authsubtoken> - to use a session token");
+ Console.WriteLine("or");
+ Console.WriteLine("ExecRequest <service> <cmd> <uri> /e
<authsubtoken> - to exchance a one time token for a session token");
return;
}
@@ -56,7 +60,29 @@
Service service = new Service(s, ApplicationName);
- service.setUserCredentials(userName, passWord);
+
+ if (userName.Equals("/a"))
+ {
+ Console.WriteLine("Using AuthSubToken: " + passWord);
+ // password should contain the authsubtoken
+ GAuthSubRequestFactory factory = new GAuthSubRequestFactory(s,
ApplicationName);
+ factory.Token = passWord;
+ service.RequestFactory = factory;
+ }
+ else if (userName.Equals("/e"))
+ {
+ Console.WriteLine("Using Onetime token: " + passWord);
+ passWord = AuthSubUtil.exchangeForSessionToken(passWord, null);
+ Console.WriteLine("Exchanged for Session Token: " + passWord);
+ // password should contain the authsubtoken
+ GAuthSubRequestFactory factory = new GAuthSubRequestFactory(s,
ApplicationName);
+ factory.Token = passWord;
+ service.RequestFactory = factory;
+ }
+ else
+ {
+ service.setUserCredentials(userName, passWord);
+ }
try
{
@@ -74,13 +100,15 @@
{
String input = Console.In.ReadToEnd();
Console.Write(input);
- service.StreamSend(new Uri(targetUri), input,
GDataRequestType.Insert);
+ Stream result = service.StreamSend(new Uri(targetUri),
input, GDataRequestType.Insert);
+ DumpStream(result);
}
if (cmd.Equals("UPDATE"))
{
String input = Console.In.ReadToEnd();
Console.Write(input);
- service.StreamSend(new Uri(targetUri), input,
GDataRequestType.Update);
+ Stream result = service.StreamSend(new Uri(targetUri),
input, GDataRequestType.Update);
+ DumpStream(result);
}
} catch (GDataRequestException e)
{
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Data API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/google-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---