Document store

Changes to allowing replacing the old document storage system with the newer rails backend app.
Also shifts authentication to the new document backend.