First take on authentication caching. Still WIP and missing some of the required features.