Skip to content

Commit

Permalink
Address CR Feedback
Browse files Browse the repository at this point in the history
- Removed debugging message.
- Refactored logout() method to remove duplicated call to
  setProviderId() method.
  • Loading branch information
sbreker committed Jun 20, 2024
1 parent 34c1f5a commit 6b0d6fa
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions plugins/arOidcPlugin/lib/oidcUser.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ public function authenticate($username = null, $password = null): bool
$authenticateResult = false;
$email = null;

$this->logger->err(sprintf('%s', json_encode(sfConfig::getAll())));

// Get provider ID from session storage as it may have been set elsewhere.
$providerId = $this->getSessionProviderId();
// Validate and set provider ID in session.
Expand Down Expand Up @@ -271,20 +269,20 @@ public function logout(): void
$this->logger->err('Setting "app_oidc_logout_redirect_url" invalid. Unable to redirect on sign out.');
}

// Dex does not yet implement end_session_endpoint with it's oidc connector
// so $this->oidcClient->signOut will fail.
// https://github.com/dexidp/dex/issues/1697
try {
// Get saved session provider id.
$providerId = $this->getSessionProviderId();
// Set provider details in the OIDC client using provider id.
if (true === $result = $this->setOidcProviderDetails($providerId)) {
// Get saved session provider id.
$providerId = $this->getSessionProviderId();
$this->setProviderId();

// Set provider details in the OIDC client using provider id.
if (true === $this->setOidcProviderDetails($providerId)) {
try {
// Dex does not yet implement end_session_endpoint with it's oidc connector
// so $this->oidcClient->signOut will fail.
// https://github.com/dexidp/dex/issues/1697
$this->oidcClient->signOut($idToken, $logoutRedirectUrl);
} catch (Exception $e) {
$this->logger->err($e->__toString().PHP_EOL);
}
$this->setProviderId();
} catch (Exception $e) {
$this->setProviderId();
$this->logger->err($e->__toString().PHP_EOL);
}
}
}
Expand Down Expand Up @@ -373,7 +371,7 @@ protected function setOidcProviderDetails(string $providerId = ''): bool
return false;
}

// Get configured provider details from ID.
// Get configured providers.
$providers = sfConfig::get('app_oidc_providers', []);
if (empty($providers)) {
$this->logger->err('OIDC providers not found in app.yml - check plugin configuration. Unable to authenticate using OIDC.');
Expand Down

0 comments on commit 6b0d6fa

Please sign in to comment.