|
17 | 17 |
|
18 | 18 | use GuzzleHttp\Exception\GuzzleException;
|
19 | 19 | use phpMyFAQ\Auth\AuthAzureActiveDirectory;
|
| 20 | +use phpMyFAQ\Configuration; |
20 | 21 | use phpMyFAQ\Filter;
|
21 | 22 | use phpMyFAQ\Session;
|
22 | 23 | use phpMyFAQ\Auth\Azure\OAuth;
|
23 | 24 | use phpMyFAQ\User\CurrentUser;
|
24 | 25 | use Symfony\Component\HttpFoundation\RedirectResponse;
|
25 | 26 |
|
| 27 | +session_start(); |
| 28 | +session_regenerate_id(true); |
| 29 | + |
26 | 30 | //
|
27 | 31 | // Prepend and start the PHP session
|
28 | 32 | //
|
|
36 | 40 | require PMF_ROOT_DIR . '/src/Bootstrap.php';
|
37 | 41 | require PMF_CONFIG_DIR . '/azure.php';
|
38 | 42 |
|
| 43 | +$faqConfig = Configuration::getConfigurationInstance(); |
| 44 | + |
39 | 45 | $code = Filter::filterInput(INPUT_GET, 'code', FILTER_SANITIZE_SPECIAL_CHARS);
|
40 | 46 | $error = Filter::filterInput(INPUT_GET, 'error_description', FILTER_SANITIZE_SPECIAL_CHARS);
|
41 | 47 |
|
42 | 48 | $session = new Session($faqConfig);
|
43 | 49 | $oAuth = new OAuth($faqConfig, $session);
|
44 | 50 | $auth = new AuthAzureActiveDirectory($faqConfig, $oAuth);
|
45 | 51 |
|
| 52 | +$redirect = new RedirectResponse($faqConfig->getDefaultUrl()); |
| 53 | + |
46 | 54 | if ($session->getCurrentSessionKey()) {
|
47 | 55 | try {
|
48 | 56 | $token = $oAuth->getOAuthToken($code);
|
|
76 | 84 | $user->setSuccess(true);
|
77 | 85 |
|
78 | 86 | // @todo -> redirect to where the user came from
|
79 |
| - $response = new RedirectResponse($faqConfig->getDefaultUrl()); |
80 |
| - $response->send(); |
| 87 | + $redirect->send(); |
81 | 88 | } catch (GuzzleException $e) {
|
82 | 89 | echo $e->getMessage();
|
83 | 90 | } catch (Exception $e) {
|
84 | 91 | echo $e->getMessage();
|
85 | 92 | }
|
86 | 93 | } else {
|
87 |
| - $response = new RedirectResponse($faqConfig->getDefaultUrl()); |
88 |
| - $response->send(); |
| 94 | + $redirect->send(); |
89 | 95 | }
|
| 96 | + |
| 97 | + |
0 commit comments