|
|
@@ -38,50 +38,77 @@ trait SSOFunctions
|
|
|
public function ssoCheck($userobj, $password, $token = null)
|
|
|
{
|
|
|
$this->setCurrentUser(false);
|
|
|
+ $this->setLoggerChannel('Authentication', $userobj['username']);
|
|
|
+ $this->logger->debug('Starting SSO check function');
|
|
|
if ($this->config['ssoPlex'] && $token) {
|
|
|
+ $this->logger->debug('Setting Plex SSO cookie');
|
|
|
$this->coookie('set', 'mpt', $token, $this->config['rememberMeDays'], false);
|
|
|
}
|
|
|
if ($this->config['ssoOmbi']) {
|
|
|
+ $this->logger->debug('Starting Ombi SSO check function');
|
|
|
$fallback = ($this->config['ombiFallbackUser'] !== '' && $this->config['ombiFallbackPassword'] !== '');
|
|
|
$ombiToken = $this->getOmbiToken($this->getSSOUserFor('ombi', $userobj), $password, $token, $fallback);
|
|
|
if ($ombiToken) {
|
|
|
+ $this->logger->debug('Setting Ombi SSO cookie');
|
|
|
$this->coookie('set', 'Auth', $ombiToken, $this->config['rememberMeDays'], false);
|
|
|
+ } else {
|
|
|
+ $this->logger->debug('No Ombi token received from backend');
|
|
|
}
|
|
|
}
|
|
|
if ($this->config['ssoTautulli'] && $this->qualifyRequest($this->config['ssoTautulliAuth'])) {
|
|
|
+ $this->logger->debug('Starting Tautulli SSO check function');
|
|
|
$tautulliToken = $this->getTautulliToken($this->getSSOUserFor('tautulli', $userobj), $password, $token);
|
|
|
if ($tautulliToken) {
|
|
|
foreach ($tautulliToken as $key => $value) {
|
|
|
+ $this->logger->debug('Setting Tautulli SSO cookie');
|
|
|
$this->coookie('set', 'tautulli_token_' . $value['uuid'], $value['token'], $this->config['rememberMeDays'], true, $value['path']);
|
|
|
}
|
|
|
+ } else {
|
|
|
+ $this->logger->debug('No Tautulli token received from backend');
|
|
|
}
|
|
|
}
|
|
|
if ($this->config['ssoJellyfin']) {
|
|
|
+ $this->logger->debug('Starting Jellyfin SSO check function');
|
|
|
$jellyfinToken = $this->getJellyfinToken($this->getSSOUserFor('jellyfin', $userobj), $password);
|
|
|
if ($jellyfinToken) {
|
|
|
foreach ($jellyfinToken as $k => $v) {
|
|
|
+ $this->logger->debug('Setting Jellyfin SSO cookie');
|
|
|
$this->coookie('set', $k, $v, $this->config['rememberMeDays'], false);
|
|
|
}
|
|
|
+ } else {
|
|
|
+ $this->logger->debug('No Jellyfin token received from backend');
|
|
|
}
|
|
|
}
|
|
|
if ($this->config['ssoOverseerr']) {
|
|
|
+ $this->logger->debug('Starting Overseerr SSO check function');
|
|
|
$fallback = ($this->config['overseerrFallbackUser'] !== '' && $this->config['overseerrFallbackPassword'] !== '');
|
|
|
$overseerrToken = $this->getOverseerrToken($this->getSSOUserFor('overseerr', $userobj), $password, $token, $fallback);
|
|
|
if ($overseerrToken) {
|
|
|
+ $this->logger->debug('Setting Overseerr SSO cookie');
|
|
|
$this->coookie('set', 'connect.sid', $overseerrToken, $this->config['rememberMeDays'], false);
|
|
|
+ } else {
|
|
|
+ $this->logger->debug('No Overseerr token received from backend');
|
|
|
}
|
|
|
}
|
|
|
if ($this->config['ssoPetio']) {
|
|
|
+ $this->logger->debug('Starting Petio SSO check function');
|
|
|
$fallback = ($this->config['petioFallbackUser'] !== '' && $this->config['petioFallbackPassword'] !== '');
|
|
|
$petioToken = $this->getPetioToken($this->getSSOUserFor('petio', $userobj), $password, $token, $fallback);
|
|
|
if ($petioToken) {
|
|
|
+ $this->logger->debug('Setting Petio SSO cookie');
|
|
|
$this->coookie('set', 'petio_jwt', $petioToken, $this->config['rememberMeDays'], false);
|
|
|
+ } else {
|
|
|
+ $this->logger->debug('No Petio token received from backend');
|
|
|
}
|
|
|
}
|
|
|
if ($this->config['ssoKomga'] && $this->qualifyRequest($this->config['ssoKomgaAuth'])) {
|
|
|
+ $this->logger->debug('Starting Komga SSO check function');
|
|
|
$komga = $this->getKomgaToken($this->getSSOUserFor('komga', $userobj), $password);
|
|
|
if ($komga) {
|
|
|
+ $this->logger->debug('Setting Komga SSO cookie');
|
|
|
$this->coookie('set', 'komga_token', $komga, $this->config['rememberMeDays'], false);
|
|
|
+ } else {
|
|
|
+ $this->logger->debug('No Komga token received from backend');
|
|
|
}
|
|
|
}
|
|
|
return true;
|