Refactored AuthenticationManager and WampCraAuthProvider and fixed some object vs array issues