[xquery-talk] Log users into existdb using md5 password (xquery)

Luca Cervone luca.cervone at unibo.it
Thu Jun 20 08:17:58 PDT 2013


Hi,
I need to log users into existdb using xquery. Of course I can use this code:

xquery version "3.0";
declare namespace exist = "http://exist.sourceforge.net/NS/exist";
declare namespace request="http://exist-db.org/xquery/request";
declare namespace xmldb="http://exist-db.org/xquery/xmldb";
declare option exist:serialize "method=json media-type=text/javascript";

let $userName := request:get-parameter("userName", ())
let $hash := request:get-parameter("hash", ())
let $login := xmldb:authenticate('/db', $userName, $hash)
return  <ajax-response>
            <success>{$login}</success>
        <username>{$userName}</username>
    </ajax-response>

The problem is that, due to the fact that I receive the password and the username from another service, I receive them in hash form encrypted with md5 (because the can't be passed in clear from a service to another).
But the xmldb:authenticate function needs the password in clear. How can I resolve this? Any idea? Is there a way to login 'manually' in xquery without using the authenticate function?


Luca Cervone
Web And XML Solutions Designer

CIRSFID - University of Bologna, Via Galliera 3, 40122, Bologna (Italy)
Office Phone Number:   +39 051 277267
Home Phone Number:   +39 051 19982894
Mobile Phone:                 +39 3482627545
Skype:                              cervoneluca
Email:                               cervoneluca at gmail.com, luca.cervone at unibo.it


5x1000 AI GIOVANI RICERCATORI
DELL'UNIVERSITÀ DI BOLOGNA
Codice Fiscale: 80007010376
www.unibo.it/Vademecum5permille

Questa informativa è inserita in automatico dal sistema al fine esclusivo della realizzazione dei fini istituzionali dell’ente.



More information about the talk mailing list