[Cubicweb] [PROVENANCE INTERNET] Re: Apache authentication: which CubicWeb API?

Dimitri Papadopoulos Orfanos dimitri.papadopoulos at cea.fr
Tue Oct 8 17:17:48 CEST 2013


I've tried the following code, where I try to access the preferences of 
the account (I chose the "/myprefs/" page of the application as a 
standard URL that does require authentication). Whether the identifier 
pair is correct or not, I get the HTTP status code 200 (Success: OK). 
The HTML page just contains this error message in case of authentication 
failure: "You have no access to this view or it can not be used to 
display the current data."

Any clue on how to modify this code to detect authentication failures 
(without parsing the HTML page)?

Genrally speaking, I cannot find any clue in the documentation on how to 
(programatically) query a CubicWeb database using HTTP. Is there basic 
documentation on how to access the data in CubicWeb databases?


BASE_URL = 'http://neurospin-cubicweb/localizer/myprefs'
LOGIN = 'some_user'
PASSWORD = 'wrong_password'
import urllib2
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor())
url = '%s?__login=%s&__password=%s' % (BASE_URL,
                                        urllib2.quote(LOGIN),
                                        urllib2.quote(PASSWORD))
answer = opener.open(BASE_URL)
print answer.getcode()
opener.close()

Le 07/10/2013 13:59, Dimitri Papadopoulos Orfanos a écrit :
> I'm afraid I don't understand.
>
> The base URL of our application is:
> http://neurospin-cubicweb/localizer/
>
> I've typed this URL in a Web browser:
> http://neurospin-cubicweb/localizer/?__login=MyLogin&__password=PassWord
>
> I get the HTTP status code 200 (Success: OK) although the page reads
> "authentication failure".
>
> If I change "MyLogin" and "PassWord" to a valid identifier pair, I still
> get "authentication failure" - and the HTTP status code is again 200
> (Success: OK).
>
> Le 07/10/2013 12:05, Aurélien Campéas a écrit :
>> On 07/10/2013 12:03, Aurélien Campéas wrote:
>>> http://myapp/?__login=<login>,__password=<pasword>    ?
>>>
>>>
>>
>> oops ...
>>
>> http://myapp/?__login=<login>&__password=<pasword>
>> _______________________________________________
>> Cubicweb mailing list
>> Cubicweb at lists.cubicweb.org
>> http://lists.cubicweb.org/mailman/listinfo/cubicweb
>

-- 
Dimitri Papadopoulos
CEA/Saclay
I2BM, NeuroSpin
F-91191 Gif-sur-Yvette cedex, France



More information about the Cubicweb mailing list