Configures authentication middleware.
key- secure key for hashing payload (if persistent key not provided, new key is generated with each server start - logging out all users)
version- should be increased with every change in
createSessionfunction, so users using old structure are logged out
createSession- function returning data which identifies user (usually user id)
getUserForSession- function which checks if user exists/session is valid (data returned from
createSessionare supplied) and result is put into