drupal caching problem workaround

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