Fix AuthenticationException management and invert internal and external
auth providers order.