Skip to content

Commit

Permalink
refactor: reverted new path for EntraID login (#3202)
Browse files Browse the repository at this point in the history
  • Loading branch information
thorsten committed Nov 2, 2024
1 parent 73f9ab7 commit bfb3d3d
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docs/administration.md
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ Follow these steps to create an App Registration in Microsoft Azure:

1. In the "Name" field, provide a name for your App Registration, e.g. "phpMyFAQ".
2. Choose the supported account types that your application will authenticate: "Accounts in this organizational directory only"
3. In the "Redirect URI" section, specify the redirect URI where Entra ID will send authentication responses: `http://www.example.com/faq/services/entra-id/callback.php`
3. In the "Redirect URI" section, specify the redirect URI where Entra ID will send authentication responses: `http://www.example.com/faq/services/azure/callback.php`
4. Click the "Register" button to create the App Registration.

**Step 5: Configure Authentication**
Expand Down
2 changes: 1 addition & 1 deletion phpmyfaq/assets/templates/admin/login.twig
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
</a>
{% endif %}
{% if hasSignInWithMicrosoftActive %}
<a class="w-100 py-2 mb-2 btn btn-outline-warning rounded-3" href="../services/entra-id">
<a class="w-100 py-2 mb-2 btn btn-outline-warning rounded-3" href="../services/azure">
<i class="bi bi-windows" aria-hidden="true"></i>
{{ msgSignInWithMicrosoft }}
</a>
Expand Down
2 changes: 1 addition & 1 deletion phpmyfaq/assets/templates/default/login.twig
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
</a>
{% endif %}
{% if useSignInWithMicrosoft %}
<a class="w-100 py-2 mb-2 btn btn-outline-dark rounded-3" href="./services/entra-id">
<a class="w-100 py-2 mb-2 btn btn-outline-dark rounded-3" href="./services/azure">
<i class="bi bi-windows" aria-hidden="true"></i>
{{ 'msgSignInWithMicrosoft' | translate }}
</a>
Expand Down
6 changes: 3 additions & 3 deletions phpmyfaq/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@
}

if ($faqConfig->isSignInWithMicrosoftActive() && $user->getUserAuthSource() === 'azure') {
$redirect = new RedirectResponse($faqConfig->getDefaultUrl() . 'services/entra-id/logout.php');
$redirect = new RedirectResponse($faqConfig->getDefaultUrl() . 'services/azure/logout.php');
$redirect->send();
}

Expand Down Expand Up @@ -279,11 +279,11 @@
if ($faqSession->getCurrentSessionId() > 0) {
$faqSession->setCookie(UserSession::COOKIE_NAME_SESSION_ID, $faqSession->getCurrentSessionId());
if (is_null($sidCookie)) {
$sids = sprintf('sid=%d&amp;lang=%s&amp;', $faqSession->getCurrentSessionId(), $faqLangCode);
$sids = sprintf('sid=%d&lang=%s&', $faqSession->getCurrentSessionId(), $faqLangCode);
}
} elseif (is_null($sidGet) || is_null($sidCookie)) {
if (is_null($sidCookie) && !is_null($sidGet)) {
$sids = sprintf('sid=%d&amp;lang=%s&amp;', $sidGet, $faqLangCode);
$sids = sprintf('sid=%d&lang=%s&', $sidGet, $faqLangCode);
}
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion phpmyfaq/src/phpMyFAQ/Auth/AuthEntraId.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public function authorize(): void
'?response_type=code&client_id=%s&redirect_uri=%s&scope=%s&code_challenge=%s&code_challenge_method=%s',
AAD_OAUTH_TENANTID,
AAD_OAUTH_CLIENTID,
urlencode($this->configuration->getDefaultUrl() . 'services/entra-id/callback.php'),
urlencode($this->configuration->getDefaultUrl() . 'services/azure/callback.php'),
AAD_OAUTH_SCOPE,
$this->oAuthChallenge,
self::ENTRAID_CHALLENGE_METHOD
Expand Down
2 changes: 1 addition & 1 deletion phpmyfaq/src/phpMyFAQ/Auth/EntraId/OAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function getOAuthToken(string $code): stdClass
'body' => [
'grant_type' => 'authorization_code',
'client_id' => AAD_OAUTH_CLIENTID,
'redirect_uri' => $this->configuration->getDefaultUrl() . 'services/entra-id/callback.php',
'redirect_uri' => $this->configuration->getDefaultUrl() . 'services/azure/callback.php',
'code' => $code,
'code_verifier' => $codeVerifier,
'client_secret' => AAD_OAUTH_SECRET
Expand Down

0 comments on commit bfb3d3d

Please sign in to comment.