while debugging my application I realized that the hasRole method in the Identity class calls tryLogin, which means that it will attempt to log the user if he is not already logged in. Is that really the expected behavior? When I first used hasRole I assumed that it would just return false when the user is not logged in. I find it a bit odd that a method like hasRole can actually change the state of the application.
Does anyone know if there is a reason behind the current implementation?