-
Send
username
+password
to server, like so:TEMPLATE <<<< { auth: username: 'your-username' password: 'your-password' }
or
TEMPLATE <<<< { auth: token: 'your-existing-token' }
-
Check if user exists in the database.
-
If exists, generate
a-random-token
in the server -
Add the following object to the
session-cache
store:session-cache[a-random-token] = { user: the-user-id date: some-timestamp }
-
Send the token to the client:
TEMPLATE <<<< { auth: token: 'a-random-token' user: the-user-id }
Send following message to logout:
TEMPLATE <<<< {
auth: logout: yes
}
Server responds with the following message:
TEMPLATE <<<< {
auth: logout: 'ok'
}
- Any messages should be dropped if it doesn't exist in the temporary authentication table.
- At the destination, all messages will be checked if sender is authorized to perform that action.
- If unauthorized, send an exception message back.
- An attacker might get whole password database.
- Attacker might (and probably will) know the hash algorithm we are using.
- With these informations, he/she shouldn't be able to
- Retrieve original password.
- Retrieve any sensitive user data