drupal caching problem workaround

parent 38bb7004
...@@ -208,6 +208,7 @@ class CASLogin extends ControllerBase ...@@ -208,6 +208,7 @@ class CASLogin extends ControllerBase
return new RedirectResponse($this->redirectUrl . $epalToken.'&auth_role=' . $exposedRole, 302, []); return new RedirectResponse($this->redirectUrl . $epalToken.'&auth_role=' . $exposedRole, 302, []);
} else { } else {
\Drupal::service('page_cache_kill_switch')->trigger();
return new RedirectResponseWithCookieExt($this->redirectUrl . $epalToken.'&auth_role=' . $exposedRole, 302, []); return new RedirectResponseWithCookieExt($this->redirectUrl . $epalToken.'&auth_role=' . $exposedRole, 302, []);
} }
// $headers = array("auth_token" => $epalToken, "auth_role" => "director"); // $headers = array("auth_token" => $epalToken, "auth_role" => "director");
......
...@@ -95,9 +95,9 @@ class CASLogout extends ControllerBase ...@@ -95,9 +95,9 @@ class CASLogout extends ControllerBase
} }
// Enable debugging // Enable debugging
// phpCAS::setDebug("/home/haris/devel/eepal/drupal/modules/casost/phpcas.log"); phpCAS::setDebug("phpcas.log");
// Enable verbose error messages. Disable in production! // Enable verbose error messages. Disable in production!
// phpCAS::setVerbose(true); phpCAS::setVerbose(true);
// Initialize phpCAS // Initialize phpCAS
phpCAS::client($this->serverVersion, phpCAS::client($this->serverVersion,
...@@ -120,10 +120,11 @@ class CASLogout extends ControllerBase ...@@ -120,10 +120,11 @@ class CASLogout extends ControllerBase
return $response; return $response;
} }
// phpCAS::handleLogoutRequests(); phpCAS::handleLogoutRequests();
// phpCAS::logoutWithRedirectService('http://eduslim2.minedu.gov.gr/dist/#/school'); // phpCAS::logoutWithRedirectService('http://eduslim2.minedu.gov.gr/dist/#/school');
session_unset(); // session_unset();
session_destroy(); // session_destroy();
$user->setPassword(uniqid('pw')); $user->setPassword(uniqid('pw'));
$user->save(); $user->save();
$response = new Response(); $response = new Response();
...@@ -131,7 +132,14 @@ class CASLogout extends ControllerBase ...@@ -131,7 +132,14 @@ class CASLogout extends ControllerBase
$response->setStatusCode(Response::HTTP_OK); $response->setStatusCode(Response::HTTP_OK);
$response->headers->set('Content-Type', 'application/json'); $response->headers->set('Content-Type', 'application/json');
return $response; // phpCAS::logout(array('url'=>$this->redirectUrl));
// phpCAS::logout();
session_unset();
session_destroy();
$this->logger->warning("hello from logout");
\Drupal::service('page_cache_kill_switch')->trigger();
return new RedirectResponseWithCookieExt("https://sso-test.sch.gr/logout", 302, []);
// return $response;
} catch (\Exception $e) { } catch (\Exception $e) {
$this->logger->warning($e->getMessage()); $this->logger->warning($e->getMessage());
$response = new Response(); $response = new Response();
......
...@@ -9,7 +9,7 @@ oauthost.callback_log_in: ...@@ -9,7 +9,7 @@ oauthost.callback_log_in:
defaults: defaults:
_controller: '\Drupal\oauthost\Controller\CBController::loginCB' _controller: '\Drupal\oauthost\Controller\CBController::loginCB'
requirements: requirements:
_permission: 'access content' _access: 'TRUE'
oauthost.log_out_go: oauthost.log_out_go:
path: /oauth/logout path: /oauth/logout
options: options:
......
...@@ -67,7 +67,6 @@ class CBController extends ControllerBase ...@@ -67,7 +67,6 @@ class CBController extends ControllerBase
$oauthostSessions = $this->entityTypeManager->getStorage('oauthost_session')->loadByProperties(array('name' => $request->query->get('sid_ost'))); $oauthostSessions = $this->entityTypeManager->getStorage('oauthost_session')->loadByProperties(array('name' => $request->query->get('sid_ost')));
$this->oauthostSession = reset($oauthostSessions); $this->oauthostSession = reset($oauthostSessions);
$this->logger->warning('$configRowName=gjvjvjgvjhvjhv'.'***sid='.$this->oauthostSession->id());
if ($this->oauthostSession) { if ($this->oauthostSession) {
$this->requestToken = $this->oauthostSession->request_token->value; $this->requestToken = $this->oauthostSession->request_token->value;
$this->requestTokenSecret = $this->oauthostSession->request_token_secret->value; $this->requestTokenSecret = $this->oauthostSession->request_token_secret->value;
...@@ -99,25 +98,20 @@ $this->logger->warning('$configRowName=gjvjvjgvjhvjhv'.'***sid='.$this->oauthost ...@@ -99,25 +98,20 @@ $this->logger->warning('$configRowName=gjvjvjgvjhvjhv'.'***sid='.$this->oauthost
$response->headers->set('Content-Type', 'application/json'); $response->headers->set('Content-Type', 'application/json');
return $response; return $response;
} }
$authToken = $request->query->get('oauth_token'); $authToken = $request->query->get('oauth_token');
$authVerifier = $request->query->get('oauth_verifier'); $authVerifier = $request->query->get('oauth_verifier');
// $this->logger->notice('authToken='.$authToken.'***authVerifier='.$authVerifier); // $this->logger->notice('authToken='.$authToken.'***authVerifier='.$authVerifier);
$epalToken = $this->authenticatePhase2($request, $authToken, $authVerifier); $epalToken = $this->authenticatePhase2($request, $authToken, $authVerifier);
if ($epalToken) { if ($epalToken) {
if ('oauthost_taxisnet_config' === $configRowName) { if ('oauthost_taxisnet_config' === $configRowName) {
/* $this->logger->notice('$configRowName='.$configRowName.'***url='.$this->redirect_url); /* $this->logger->notice('$configRowName='.$configRowName.'***url='.$this->redirect_url);
$cookie = new Cookie('auth_token', $epalToken, 0, '/', null, false, false); $cookie = new Cookie('auth_token', $epalToken, 0, '/', null, false, false);
$cookie2 = new Cookie('auth_role', 'student', 0, '/', null, false, false); */ $cookie2 = new Cookie('auth_role', 'student', 0, '/', null, false, false); */
return new RedirectResponse($this->redirect_url . $epalToken.'&auth_role=student', 302, []); return new RedirectResponse($this->redirect_url . $epalToken.'&auth_role=student', 302, []);
} else { } else {
// $this->logger->notice('***url2='.$this->redirect_url); \Drupal::service('page_cache_kill_switch')->trigger();
return new RedirectResponseWithCookieExt($this->redirect_url . $epalToken.'&auth_role=student', 302, []); return new RedirectResponseWithCookieExt($this->redirect_url . $epalToken.'&auth_role=student', 302, []);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment