Skip to content

[WIP] JWT Auth integration#460

Open
ferishili wants to merge 15 commits intoopencast-ilias:release_9from
elan-ev:jwt
Open

[WIP] JWT Auth integration#460
ferishili wants to merge 15 commits intoopencast-ilias:release_9from
elan-ev:jwt

Conversation

@ferishili
Copy link
Copy Markdown
Contributor

This PR fixes #459,

NOTE: It is still work in progress!

  • configuration for JWT, with key masking js.
  • all publications urls would get the jwt as query param
  • studio and editor redirect would get the JWT with a form submission to make opencast be aware of the session with JWT.
  • OpencastAPI class now contains all required methods for attaching JWT to the url and so on.

In order to test this PR, the JWT Auth should be also activated in your Opencast: https://docs.opencast.org/r/18.x/admin/#configuration/security.jwt/#spring-security-configuration

For our Opencast community instance : It is deactivated, since there are active tests in other ReviewApps, so in order to test this, we have inform others, since activating the JWT in Opencastwould result in 403 Error for others!

- configuration for JWT, with key masking js.
- all publications urls would get the jwt as query param
- studio and editor would get the JWT with a form submission.
- OpencastAPI class now contains all required methods for attaching JWT to the url and so on.
@ferishili ferishili requested a review from dagraf October 17, 2025 13:23
@ferishili ferishili self-assigned this Oct 17, 2025
@ferishili ferishili added enhancement New feature or request ILIAS 9 Issue appears or may only appear on ILIAS 9. labels Oct 17, 2025
@ferishili ferishili moved this from Backlog to In progress in Opencast & Opencast PageComponent Oct 17, 2025
@dagraf dagraf moved this from In progress to Testing in Opencast & Opencast PageComponent Nov 4, 2025
@dagraf
Copy link
Copy Markdown

dagraf commented Nov 4, 2025

In meeting: Community-Opencast is configured with JWT. Ansible scripts available for configuration of Opencast installation available.

ReviewApp: http://oc-pr-460.opencast.k8s.sr.solutions/

@dagraf
Copy link
Copy Markdown

dagraf commented Dec 2, 2025

In Sitzung: Hauptsächlich zu testen sind Thumbnails-Anzeige, Videos-Aufruf, Captions, Segments-Thumbnails und Sanity-Test. Testing dieses PRs hat Prio gegenüber 10er-Version testing (durch @dagraf).

@ferishili
Copy link
Copy Markdown
Contributor Author

FYI: The iframe integration is available.

A few important notes:

@dagraf
Copy link
Copy Markdown

dagraf commented Apr 23, 2026

All tests were successful (with JWT enabled and disabled).

Therefore and @chfsx: Can you please review this PR and merge it, if everything is fine or comment here if you see any issues? Thank you!

As soon as this PR passes the review state and it is ready for merging, @ferishili will write a documentation for "How to configure Opencast for JWT".

@dagraf dagraf moved this from Testing to In review in Opencast & Opencast PageComponent Apr 23, 2026
@dagraf dagraf requested a review from chfsx April 23, 2026 07:47
Copy link
Copy Markdown
Contributor

@chfsx chfsx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ferishili many thanks for the implementation!è the PR is quite huge, I have not yet finished the whole review... but I send you my first findings so you can already begin to tackle them, ok?

Comment thread classes/Conf/class.xoctConfFormGUI.php Outdated
Comment thread classes/Event/class.xoctEventGUI.php Outdated
Comment thread classes/Event/class.xoctEventGUI.php Outdated
$tpl->setVariable("JS_CONFIG", json_encode($this->buildJSConfig($event)));
}

if (empty($tpl)) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

due to the if/else, $tpl cannot be empty right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean, we should get rid of if(empty($tpl)) block?

Comment thread classes/class.xoctGUI.php Outdated
*/
public function refreshJwtAsync(): void
{
$event_id = $this->http->request()->getQueryParams()[xoctEventGUI::IDENTIFIER] ?? null;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there should be a check of permissions: is the current user allowed to get a new token? FMPOV someone could create tokens for every event if they want to

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took care of it and added the code to check the read permission. However, based on my permission tests, unauthorized access will be denied long before reaching this method by the top-level classes.

Comment thread classes/Player/class.xoctPlayerGUI.php
header('Location: ' . $event->publications()->getPlayerLink());
$this->closeResponse();
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need a $jwt_iframe_capable = false; here for the catch case. OR (or maybe AND) in $line 85 should be a $this->closeConnection();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if I understood you correctly!
but:

  1. The header('Location: ' . $event->publications()->getPlayerLink()); would take care of it, since it redirects so the process is exited at this point!

  2. I am not able to find any closeConnection from trait OutputResponse! Maybe a typo?

Comment thread composer.json
Comment thread classes/Player/class.xoctPlayerGUI.php
Comment thread test_paella_livestream.html
@ferishili ferishili requested a review from chfsx April 24, 2026 13:47
@ferishili
Copy link
Copy Markdown
Contributor Author

Just as a small note: there will be an additional JWT authentication mechanism for Annotation, similar to the one used by Studio and the Editor, which I plan to add later.

as it is minimum supported php version
@ferishili
Copy link
Copy Markdown
Contributor Author

@chfsx The latest commit includes a rebuild with PHP 8.1 and an upgrade of Guzzle (which wasn't intentional, but happened as part of the process).

No need to worry about the large number of changes under vendor, they're all automated and related to this commit:
4e25a9f

@ferishili
Copy link
Copy Markdown
Contributor Author

@chfsx The changes regarding annotation-tool JWT compatibility are there, please continue with your review!
Thanks in advance

@chfsx
Copy link
Copy Markdown
Contributor

chfsx commented May 5, 2026

Thanks a lot @ferishili for your work! This is now ready to merge FMPOV, let's discuss this in the meeting this afternoon

@chfsx chfsx moved this from In review to Ready to merge in Opencast & Opencast PageComponent May 5, 2026
@dagraf
Copy link
Copy Markdown

dagraf commented May 5, 2026

In meeting: We decided to merge it in the upcoming release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request ILIAS 9 Issue appears or may only appear on ILIAS 9.

Projects

Status: Ready to merge

Development

Successfully merging this pull request may close these issues.

Integrate JWT Authentication from the Opencast PHP Library

3 participants