Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Thulin committed Jan 17, 2025
1 parent 30d0ad5 commit b58d0cd
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions library/Integrations/MiniOrange/AllowRedirectAfterSsoLogin.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,19 @@ public function addHooks(): void

/**
* Set logged in cookie filter proxy.
*
*
* @param string $loggedInCookie
* @param int $expire
* @param int $expiration
* @param int $userId
*
*
* @suppress PhanUnusedVariable, IntelephenseUnusedVariable
*
*
* @return void
*/
public function setLoggedInCookieFilterProxy(string $loggedInCookie, int $expire, int $expiration, int $userId) {
$this->allowRedirectAfterSsoLogin($userId);
public function setLoggedInCookieFilterProxy(string $loggedInCookie, int $expire, int $expiration, int $userId): void
{
$this->allowRedirectAfterSsoLogin($userId);
}

/**
Expand All @@ -56,28 +57,29 @@ public function allowRedirectAfterSsoLogin(int $userId): void
return;
}

$redirectUrl = $this->wpService->applyFilters(self::REDIRECT_URL_FILTER_HOOK, '', $userId);
$redirectUrl = $this->wpService->applyFilters(self::REDIRECT_URL_FILTER_HOOK, '', $userId);

if (!empty($redirectUrl)) {
$redirectHandler = function($location) use ($redirectUrl) {
$redirectHandler = function ($location) use ($redirectUrl) {
return ($location === $this->getRelayState()) ? $redirectUrl : $location;
};
};
$this->wpService->addFilter('wp_redirect', $redirectHandler, 5, 1);
}
}

/**
* Get RelayState.
*
*
* @return string|null
*/
private function getRelayState(): ?string {
private function getRelayState(): ?string
{
return $_POST['RelayState'] ?? null;
}

/**
* Get SAML response.
*
*
* @return string|null
*/
private function getSamlResponse(): ?string
Expand All @@ -95,4 +97,3 @@ private function doingMiniOrgangeLogin(): bool
return $this->getSamlResponse() && $this->getRelayState();
}
}

0 comments on commit b58d0cd

Please sign in to comment.