jbrzusto / motusServer

R package to operate a server that processes data for https://motus.org
GNU General Public License v2.0
1 stars 0 forks source link

have statusServer() return json data and wrap in a php front-end #222

Open jbrzusto opened 7 years ago

jbrzusto commented 7 years ago

By providing a clean JSON-based API (as for dataServer), we gain:

Overall design:

jbrzusto commented 7 years ago

see Denis' elaboration and comments in #265

jbrzusto commented 7 years ago

Basic Design of Status API

authentication

For status, we (i.e. the php wrapper) currently authenticate (username, password) against motus.org/api/user/authenticate, then generate a ticket: a signed username+group tokens which can be verified by any program having access to the single shared secret used in signing. This means all points requiring authentication by ticket can check tickets using only the static shared secret, rather than requiring access to a dynamic database of tokens or username/password pairs. The ticket does not leak password information, and group tokens cannot be spoofed.

However, the static shared secret must be updated from time to time for better security, which is a maintenance chore.

Summarizing the options

This would all benefit from a comprehensive rethink, but expediency suggests the hybrid solution as the way to go.

A single motusServer function, validate_request() can test requests with JSON payloads having authToken, and if the latter contains a ! character, treat it as a ticket, rather than a token.