Rework of authentication Ready for testing