Codebase list virt-viewer / 4f37332
ovirt: Use sso-token when set in .vv file Starting with oVirt 4.0, this replaces the jsessionid field for automatic authentication with oVirt instances for REST communication. Christophe Fergeau 7 years ago
2 changed file(s) with 31 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
308308
309309 =item C<jsessionid> (string)
310310
311 Value to set the 'jsessionid' cookie to. Setting this authentication cookie to a valid value
312 will allow to interact with the oVirt REST API without being asked for credentials.
311 Value to set the 'jsessionid' cookie to. With oVirt 3.6, setting this
312 authentication cookie to a valid value will allow to interact with the oVirt
313 REST API without being asked for credentials.
314
315 =item C<sso-token> (string)
316
317 Value to set the 'Authorization' header to. With oVirt 4.0 or newer, setting
318 this authentication header to a valid value will allow to interact with the
319 oVirt REST API without being asked for credentials.
313320
314321 =item C<ca> (string)
315322
833833 gboolean admin;
834834 char *ca_str = NULL;
835835 char *jsessionid = NULL;
836 char *sso_token = NULL;
836837 char *url = NULL;
837838 char *vm_guid = NULL;
838839 GByteArray *ca = NULL;
840841 url = virt_viewer_file_get_ovirt_host(file);
841842 vm_guid = virt_viewer_file_get_ovirt_vm_guid(file);
842843 jsessionid = virt_viewer_file_get_ovirt_jsessionid(file);
844 sso_token = virt_viewer_file_get_ovirt_sso_token(file);
843845 ca_str = virt_viewer_file_get_ovirt_ca(file);
844846 admin = virt_viewer_file_get_ovirt_admin(file);
845847
846 if ((url == NULL) || (vm_guid == NULL) || (jsessionid == NULL)) {
847 g_debug("ignoring [ovirt] section content as URL, VM GUID or jsessionid"
848 if ((url == NULL) || (vm_guid == NULL)) {
849 g_debug("ignoring [ovirt] section content as URL, VM GUID"
848850 " are missing from the .vv file");
851 goto end;
852 }
853
854 if ((jsessionid == NULL) && (sso_token == NULL)) {
855 g_debug("ignoring [ovirt] section content as jsessionid and sso-token"
856 " are both missing from the .vv file");
849857 goto end;
850858 }
851859
860868
861869 g_object_set(G_OBJECT(proxy),
862870 "admin", admin,
863 "session-id", jsessionid,
864871 "ca-cert", ca,
865872 NULL);
873 if (jsessionid != NULL) {
874 g_object_set(G_OBJECT(proxy),
875 "session-id", jsessionid,
876 NULL);
877 }
878 if (sso_token != NULL) {
879 g_object_set(G_OBJECT(proxy),
880 "sso-token", sso_token,
881 NULL);
882 }
883
866884 menu = g_object_new(OVIRT_TYPE_FOREIGN_MENU,
867885 "proxy", proxy,
868886 "vm-guid", vm_guid,
872890 g_free(url);
873891 g_free(vm_guid);
874892 g_free(jsessionid);
893 g_free(sso_token);
875894 g_free(ca_str);
876895 if (ca != NULL) {
877896 g_byte_array_unref(ca);