LoginCredentials login = LoginCredentials.class.cast(from);
JsonLoginCredentials val = new JsonLoginCredentials();
val.user = login.getUser();
val.password = login.getOptionalPassword().orNull();
val.privateKey = login.getOptionalPrivateKey().orNull();
if (login.shouldAuthenticateSudo())
val.authenticateSudo = login.shouldAuthenticateSudo();
return ByteSource.wrap(json.toJson(val).getBytes(Charsets.UTF_8));
}
return ByteSource.wrap(json.toJson(from).getBytes(Charsets.UTF_8));
}