Prevent ClassCastException if credentials are not of type
PasswordCredential.