Changes

Jump to navigation Jump to search
6 bytes removed ,  15:40, 25 July 2022
no edit summary
* All clients are based on the client/server architecture. Hence, a BaseX database server must be started first.
* Each client provides a session class or script with methods to connect to and communicate with the database server. A socket connection will be established by the constructor, which expects a host, port, user name username and password as arguments.
* The {{Code|execute()}} method is called to launch a database command. It returns the result or throws an exception with the received error message.
# Client connects to server socket
# Server sends a '''realm''' and '''nonce''', separated by a colon: <code>{realm:nonce}</code>
# Client sends the '''user nameusername''' and a hash value. The hash is composed of the md5 hash of## the md5 hash of the '''user nameusername''', '''realm''', and '''password''' (all separated by a colon), and
## the '''nonce''': <code>{username} {md5(md5(username:realm:password) + nonce)}</code>
# Server replies with <code>\00</code> (success) or <code>\01</code> (error)
# Client connects to server socket
# Server sends a '''nonce''' (timestamp): <code>{nonce}</code>
# Client sends the '''user nameusername''' and a hash value. The hash is composed of the md5 hash of
## the md5 of the '''password''' and
## the '''nonce''': <code>{username} {md5(md5(password) + nonce)}</code>
* '''Client''' connects to the database server socket
* '''Server''' sends realm and timestamp "BaseX:1369578179679": {{Code|◄ 42 61 73 65 58 3A 31 33 36 39 35 37 38 31 37 39 36 37 39 00}}
* '''Client''' sends user name username "jack": {{Code|6A 61 63 6B 00 ►}}
* '''Client''' sends hash: md5(md5("jack:BaseX:topsecret") + "1369578179679") = "ca664a31f8deda9b71ea3e79347f6666": {{Code|63 61 36 ... 00 ►}}
* '''Server''' replies with success code: {{Code|◄ 00}}
===Session===
* Create and return session with host, port, user name username and password:<br/><code>Session(String host, int port, String name, String password)</code>
* Execute a command and return the result:<br/><code>String execute(String command)</code>
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu