Start to properly implement /rest/login

Authenticate with username, password and realm.
On success return a hash based on username, password, realm and pkey.