mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-21 14:10:59 +01:00
108 lines
3.5 KiB
Plaintext
108 lines
3.5 KiB
Plaintext
/* $Id$ */
|
|
|
|
Perl interfacing to egroupware updated for Frontier-RPC-0.07b4:
|
|
|
|
The Frontier::RPC module available at CPAN is capable of logging into an
|
|
egroupware server. To authenticate your session after the initial login,
|
|
however, requires a patch to Frontier. This patch causes Frontier to create
|
|
an Authentication header using username/password values. We use the assigned
|
|
sessionid and kp3 for this.
|
|
|
|
NOTE: sessionid/kp3 values in this file are not valid.
|
|
|
|
TODO:
|
|
|
|
1. Apply the patch at the end of this file to Frontier-RPC-0.07b4.
|
|
2. Install Frontier.
|
|
3. Try the following method using rpc-client.pl in the examples subdirectory for
|
|
the Frontier source:
|
|
|
|
rpc-client.pl \
|
|
http://www.egroupware.org/egroupware/xmlrpc.php \
|
|
system.login \
|
|
"{domain => '',username => 'demo', password => 'guest'}"
|
|
|
|
4. Take the returned sessionid and kp3, e.g.:
|
|
|
|
$result = HASH(0x826d4b0)
|
|
'domain' => 'default'
|
|
'kp3' => 'e0219714614769x25bc92286016c60c2'
|
|
'sessionid' => '36f9ec1e4ad78bxd8bc902b1c38d3e14'
|
|
|
|
5. Place these on the commandline for a new request, with sessionid for
|
|
username and kp3 for password:
|
|
|
|
rpc-client.pl \
|
|
http://www.egroupware.org/egroupware/xmlrpc.php \
|
|
--username 36f9ec1e4ad78bxd8bc902b1c38d3e14 \
|
|
--password e0219714614769x25bc92286016c60c2 \
|
|
service.contacts.read \
|
|
"{ id => '4'}"
|
|
|
|
6. This should return record #4 from the addressbook application.
|
|
|
|
Other requests may require different types on the command line, e.g.:
|
|
|
|
preferences.bosettings.read "addressbook,'','user'"
|
|
|
|
Here is the patch:
|
|
|
|
----CUT HERE----
|
|
diff -aur Frontier-RPC-0.07b4/examples/rpc-client.pl Frontier-RPC-0.07b4-milos/examples/rpc-client.pl
|
|
--- Frontier-RPC-0.07b4/examples/rpc-client.pl 1999-09-02 15:16:49.000000000 -0500
|
|
+++ Frontier-RPC-0.07b4-milos/examples/rpc-client.pl 2005-07-30 05:25:36.309201144 -0500
|
|
@@ -1,4 +1,4 @@
|
|
-#
|
|
+#!/usr/bin/perl
|
|
# Copyright (C) 1998 Ken MacLeod
|
|
# See the file COPYING for distribution terms.
|
|
#
|
|
@@ -59,7 +59,9 @@
|
|
|
|
GetOptions( 'debug' => \$debug,
|
|
'encoding=s' => \$encoding,
|
|
- 'proxy=s' => \$proxy );
|
|
+ 'proxy=s' => \$proxy,
|
|
+ 'username=s' => \$username,
|
|
+ 'password=s' => \$password);
|
|
|
|
die "usage: rpc-client URL METHOD [\"ARGLIST\"]\n"
|
|
if ($#ARGV != 1 && $#ARGV != 2);
|
|
@@ -71,12 +73,18 @@
|
|
$server = Frontier::Client->new( 'url' => $url,
|
|
'debug' => $debug,
|
|
'encoding' => $encoding,
|
|
- 'proxy' => $proxy );
|
|
+ 'proxy' => $proxy,
|
|
+ 'username' => $username,
|
|
+ 'password' => $password);
|
|
+
|
|
+use Data::Dumper;
|
|
+print Dumper($server);
|
|
|
|
my @arglist;
|
|
eval "\@arglist = ($arglist)";
|
|
|
|
$result = $server->call ($method, @arglist);
|
|
+print Dumper($result);
|
|
|
|
-require 'dumpvar.pl';
|
|
-dumpvar ('main', 'result');
|
|
+#require 'dumpvar.pl';
|
|
+#dumpvar ('main', 'result');
|
|
diff -aur Frontier-RPC-0.07b4/lib/Frontier/Client.pm Frontier-RPC-0.07b4-milos/lib/Frontier/Client.pm
|
|
--- Frontier-RPC-0.07b4/lib/Frontier/Client.pm 2002-08-02 19:48:06.000000000 -0500
|
|
+++ Frontier-RPC-0.07b4-milos/lib/Frontier/Client.pm 2005-07-30 04:52:35.000000000 -0500
|
|
@@ -42,6 +42,11 @@
|
|
push @options, 'use_objects' => $self->{'use_objects'};
|
|
}
|
|
|
|
+ if(defined $self->{'username'} and defined $self->{'password'})
|
|
+ {
|
|
+ use MIME::Base64;
|
|
+ $self->{'rq'}->header('Authorization' => 'Basic ' . encode_base64($self->{'username'} . ":" . $self->{'password'}));
|
|
+ }
|
|
$self->{'enc'} = Frontier::RPC2->new(@options);
|
|
|
|
return $self;
|