Updated security layer to accept users from memory and db