Skip to content

Commit

Permalink
Feature/star 951 (#13)
Browse files Browse the repository at this point in the history
* Add starategy mode for jaas mode jitsi

* Add variable to TestCase

* Add package_status in testcase

* Correct bug

* Add try catch

* Add try catch

* Add debug

* Add debug

* Add debug

* Repair tests

* Add priority for mode video conference

* Remove secret key from config

* Add ServiceProvider to testCase

* REmove on provider

* Add missing provider totestbench

* Add provider to testcase file

* Remove courses from jitsi composer

* Add missing field to config

* Change config to jitsi, change generate url

* Add missing method to strategy

* Add app_id in jaas config

Co-authored-by: Hubert Krzysztofiak <[email protected]>
  • Loading branch information
HerbertIV and Hubert Krzysztofiak authored Jan 5, 2023
1 parent bc498dc commit 235fb77
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 21 deletions.
1 change: 0 additions & 1 deletion src/Providers/SettingsServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public function register()
AdministrableConfig::registerConfig(self::CONFIG_KEY . '.aud', ['nullable', 'string'], false);
AdministrableConfig::registerConfig(self::CONFIG_KEY . '.iss', ['nullable', 'string'], false);
AdministrableConfig::registerConfig(self::CONFIG_KEY . '.kid', ['nullable', 'string'], false);
AdministrableConfig::registerConfig(self::CONFIG_KEY . '.sub', ['nullable', 'string'], false);
AdministrableConfig::registerConfig(self::CONFIG_KEY . '.private_key', ['nullable', 'string'], false);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Services/JaasService.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function generateJwt(
'aud' => $this->config['aud'],
'iss' => $this->config['iss'],
'exp' => now()->addMinutes($expireInMinutes)->timestamp,
'sub' => $this->config['sub'],
'sub' => $this->config['app_id'],
'room' => $room,
'context' => [
'user' => $userData,
Expand Down
3 changes: 2 additions & 1 deletion src/Services/JitsiService.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public function getChannelData(
$channelName = $this->getChannelSlug($channelDisplayName);
$data = [
"domain" => $this->config[$this->mode . '_host'],
"app_id" => $this->config['app_id'],
"roomName" => $channelName,
"configOverwrite" => $configOverwrite,
"interfaceConfigOverwrite" => $interfaceConfigOverwrite,
Expand Down Expand Up @@ -150,7 +151,7 @@ protected function getUserData($user, $isModerator = false): array
*/
private function getMode(): string
{
$jaasKeys = collect(['jaas_host', 'aud', 'iss', 'kid', 'private_key']);
$jaasKeys = collect(['app_id', 'jaas_host', 'aud', 'iss', 'kid', 'private_key']);
$jaasConfigUse = true;
$jaasKeys->each(function (string $key) use (&$jaasConfigUse) {
if (!config('jitsi.' . $key)) $jaasConfigUse = false;
Expand Down
16 changes: 0 additions & 16 deletions tests/Api/SettingsApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public function testAdministrableConfigApi(): void
$appId = $this->faker->uuid;
$secret = $this->faker->uuid;
$aud = $this->faker->word;
$sub = $this->faker->word;
$iss = $this->faker->word;
$kid = $this->faker->word;
$privateKey = $this->faker->word;
Expand Down Expand Up @@ -83,10 +82,6 @@ public function testAdministrableConfigApi(): void
'key' => "$configKey.kid",
'value' => $kid,
],
[
'key' => "$configKey.sub",
'value' => $sub,
],
[
'key' => "$configKey.private_key",
'value' => $privateKey,
Expand Down Expand Up @@ -172,17 +167,6 @@ public function testAdministrableConfigApi(): void
'readonly' => false,
'value' => $iss,
],
'sub' => [
'full_key' => "$configKey.sub",
'key' => 'sub',
'rules' => [
'nullable',
'string'
],
'public' => false,
'readonly' => false,
'value' => $sub,
],
'app_id' => [
'full_key' => "$configKey.app_id",
'key' => 'app_id',
Expand Down
4 changes: 2 additions & 2 deletions tests/Services/ServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function testServiceWithJwtJaas()
'private_key_type' => OPENSSL_KEYTYPE_RSA
]);
\Config::set('jitsi.private_key', $private_key);
\Config::set('jitsi.sub', Str::random(40));
\Config::set('jitsi.app_id', Str::random(40));
\Config::set('jitsi.kid', Str::random(40));
$config = config('jitsi');
$data = Jitsi::getChannelData($this->user, $this->faker->text(15));
Expand All @@ -72,7 +72,7 @@ public function testServiceWithJwtAndSettingsJaas()
'private_key_type' => OPENSSL_KEYTYPE_RSA
]);
\Config::set('jitsi.private_key', $private_key);
\Config::set('jitsi.sub', Str::random(40));
\Config::set('jitsi.app_id', Str::random(40));
\Config::set('jitsi.kid', Str::random(40));
$config = config('jitsi');
$data = Jitsi::getChannelData($this->user, "Test Channel Name", true, ['foo' => 'bar'], ['bar' => 'foo']);
Expand Down

0 comments on commit 235fb77

Please sign in to comment.