I'm trying for long time to initiate a GET request to retrieve JSON from Opencast server. From the official website authentication mechanism that was mentioned is Basic Auth, but after searing around I found that Digest Auth is the one that is used for the API which was mentioned on:
I have been trying to connect to the API, but no results till now. I used cUrl and httpful, but it always give an error HTTP/1.1 401 An Authentication object was not found in the SecurityContext.
I used cUrl with php same issue, and example that is given on https://opencast.jira.com/wiki/display/MH/Remote+Services is not working at all:
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url.$uri);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
curl_setopt($ch, CURLOPT_USERPWD, $username.':'.$password);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("X-Requested-Auth: Digest"));
curl_setopt($ch, CURLOPT_HTTPHEADER, array("X-Opencast-Matterhorn-Authorization: true"));
$response = curl_exec($ch);
May someone tell me what is the right auth mechanism used to connect to Opencast API and how I can connect to? all trails didn't success.
You need to use digest or form based auth by default or need to activate basic auth in spring security. Example for digest auth (ingest media):
curl -f -i --digest -u opencast_system_account:CHANGE_ME -H "X-Requested-Auth: Digest" http://localhost:8080/ingest/addMediaPackage/fast -F 'flavor=presentation/source' -F 'BODYemail@example.com' -F title="Some title" -F creator="John Doe"