You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Peter Decrem <th...@gmail.com> on 2006/09/10 17:56:08 UTC

gdata-server newbie installation/code question

I was able to create the war gdata-server file with simon's documentation.
The documentation now states I should create user accounts.  Does the
section below (authenticate an existing account) also need to be included
(in the section Create/update/delete an account) ?  Is the
yourAuthenticationstring the same as authToken in the code directly below
this?  Should I assume that GoogleLogin really means gdata-server login ?

Thanks

___
 Authenticate an existing account

Requiered jars:

   -

   gdata-client.jar

____

 /*
  * The protocol can either be http or https, depends on your server
configuration.
  * The name of the application is just a meta data field an can be ommited.
  */
  GoogleService service = new
GoogleService("feedId","yourapplicationname", "http",
"localdomain:port/gdata-server");
 /*
  * ServiceType should be configured in the gdata-config.xml
  * Username and password for the admin account are the default values
  * and should be changed
  */
  String authToken = service.getAuthToken("administrator","password",
null,null,"servicetype","yourapplicationname");

____

Create/update/delete an account

____

 String accountAdminEndpoint =
"http://www.yourdomain.com/gdata-server/admin/account";
  /*
   * XML Account format to send in the http request body
   */
  String account = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
  "<account>" +
    "<account-name>administrator</account-name>" +
    "<password>yourpassword</password>" +
    "<account-role>15</account-role>" +
    "<account-owner>" +
      "<name>your name</name>" +
      "<email-address>admin@apache.org</email-address>" +
      "<url>http://www.apache.org</url>" +
    "</account-owner>" +
    "</account>";

  RequestEntity feedReqeustEnt = new StringRequestEntity(account);
  /*
   * Put method to update the account
   */
  PutMethod httpMethod = new PutMethod(accountAdminEndpoint);
  /*
   * you need to authenticate before adding a new feed. Authentication
   * will return an authentication token.
   */
  httpMethod.addRequestHeader(new Header("Authorization",
  "GoogleLogin auth=yourAuthenticationstring"));
  httpMethod.setRequestEntity(feedReqeustEnt);

Re: gdata-server newbie installation/code question

Posted by Simon Willnauer <si...@googlemail.com>.
On 9/10/06, Peter Decrem <th...@gmail.com> wrote:
> I was able to create the war gdata-server file with simon's documentation.
> The documentation now states I should create user accounts.  Does the
> section below (authenticate an existing account) also need to be included
> (in the section Create/update/delete an account) ?
Yes and No, This is still a bit difficult and I'm not happy with the
administration interface. So If you want to create your own account
you need to authenticate with the predefined admin account. The
authentication returns a String token which is your authtoken. with
this auth token you can create a new user.

 Is the
> yourAuthenticationstring the same as authToken in the code directly below
> this?  Should I assume that GoogleLogin really means gdata-server login ?
Yes it is. GoogleLogin is just the name of the parameter the
application looks for to authenticate the user. This will be
configurable in the future. Currently this is as described in the
gdata protocol definition as GoogleLogin.

best regards Simon
>
> Thanks
>
> ___
>  Authenticate an existing account
>
> Requiered jars:
>
>    -
>
>    gdata-client.jar
>
> ____
>
>  /*
>   * The protocol can either be http or https, depends on your server
> configuration.
>   * The name of the application is just a meta data field an can be ommited.
>   */
>   GoogleService service = new
> GoogleService("feedId","yourapplicationname", "http",
> "localdomain:port/gdata-server");
>  /*
>   * ServiceType should be configured in the gdata-config.xml
>   * Username and password for the admin account are the default values
>   * and should be changed
>   */
>   String authToken = service.getAuthToken("administrator","password",
> null,null,"servicetype","yourapplicationname");
>
> ____
>
> Create/update/delete an account
>
> ____
>
>  String accountAdminEndpoint =
> "http://www.yourdomain.com/gdata-server/admin/account";
>   /*
>    * XML Account format to send in the http request body
>    */
>   String account = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
>   "<account>" +
>     "<account-name>administrator</account-name>" +
>     "<password>yourpassword</password>" +
>     "<account-role>15</account-role>" +
>     "<account-owner>" +
>       "<name>your name</name>" +
>       "<email-address>admin@apache.org</email-address>" +
>       "<url>http://www.apache.org</url>" +
>     "</account-owner>" +
>     "</account>";
>
>   RequestEntity feedReqeustEnt = new StringRequestEntity(account);
>   /*
>    * Put method to update the account
>    */
>   PutMethod httpMethod = new PutMethod(accountAdminEndpoint);
>   /*
>    * you need to authenticate before adding a new feed. Authentication
>    * will return an authentication token.
>    */
>   httpMethod.addRequestHeader(new Header("Authorization",
>   "GoogleLogin auth=yourAuthenticationstring"));
>   httpMethod.setRequestEntity(feedReqeustEnt);
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org