[Ricardo Rodriguez] Your EPEC Network ICT Team wrote:
Hi all,
We are using XWiki to share/develop R code.
R has a source() command that can call a remote web page where the code
is stored and execute it locally. We can figure out more sophisticated
ways of getting R involved, but as an starting point it could be enough
to be able to call restricted access XWiki URLs from local R
installations with the source() command. Thus, I think that we need to
send to XWiki the username and the password together with this URL.
Please, could you now if this is possible and point me in the right
direction? Thanks!
Best regards,
Ricardo
Hi,
Following some advise from people in the R r-help e-mail list and from
some other threads here I can read the following authentication header:
----------------------------------------------------------
http://MyHostName/xwiki/bin/loginsubmit/XWiki/XWikiLogin
POST /xwiki/bin/loginsubmit/XWiki/XWikiLogin HTTP/1.1
Host: MyHostName
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US;
rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12
Accept:
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en,en-us;q=0.7,es-es;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: UTF-8,*
Keep-Alive: 300
Connection: keep-alive
Referer:
http://MyHostName/xwiki/bin/login/XWiki/XWikiLogin?xredirect=http%3A%2F%2FM…
Cookie: JSESSIONID=A89FBB1701789DE208FFDBD732E9EFFD; style=default
Content-Type: application/x-www-form-urlencoded
Content-Length: 146
xredirect=http%3A%2F%2FMyHostName%2Fxwiki%2Fbin%2Fview%2FMain%2F&j_username=xxxxxxxxx&j_password=xxxxxxxxx&j_rememberme=true
HTTP/1.x 302 Moved Temporarily
Server: Apache-Coyote/1.1
Set-Cookie: username=xxxxxxxxx==; Expires=Sun, 02-Mar-2008 11:26:15 GMT;
Path=/
Set-Cookie: password=xxxxxxxxx==; Expires=Sun, 02-Mar-2008 11:26:15 GMT;
Path=/
Set-Cookie: rememberme=true; Expires=Sun, 02-Mar-2008 11:26:15 GMT; Path=/
Set-Cookie: validation=2ea9cbeb40bdafc8314b50f18b440e30; Expires=Sun,
02-Mar-2008 11:26:15 GMT; Path=/
Location:
http://MyHostName/xwiki/bin/view/Main/
Content-Type: text/html;charset=ISO-8859-1
Content-Language: en
Content-Length: 0
Date: Sat, 16 Feb 2008 11:26:15 GMT
----------------------------------------------------------
I've replaced username and password values with xxxxxxxxx and the real
hostname with MyHostName.
In xredirect I can easily identify : as %3A and / as %2F. But, is it
possible to pass the string &j_ in an "regular" URL? Is this possible to
pass username and password with this string as an URL to access a
restricted access document or it is a requirement that the cookies are
set before the client can read it?
For instance, could I pass username and password with the following URL...?
http://xepecnet.environmentalchange.net/xwiki/bin/view/ICT/RGraphicSample01…
I keep trying to pass the code in this document to R. This is what I get
right now...
source("http://xepecnet.environmentalchange.net/xwiki/bin/view/ICT/RGr…
Error in file(file, "r", encoding = encoding) : unable to open connection
In addition: Warning message:
In file(file, "r", encoding = encoding) :
cannot open: HTTP status was '401 Unauthorized'
Thanks for your help!
Best,
Ricardo
--
Ricardo Rodríguez
Your EPEC Network ICT Team