Prevent class cast exception when current credentials are not
PasswordCredentials.