chore(session): moves persistent login logic to service

This adds a persistent login service, which centralizes this logic and
documents the processes and legacy information.

Fixes #6631
chore(tests): Add unit tests for persistent login service

This also adds some undocumented properties on the service in order to
inject test mocks for things like get_user.