public function CasRouteEnhancer::enhance in CAS 8
Same name and namespace in other branches
- 2.x src/Routing/CasRouteEnhancer.php \Drupal\cas\Routing\CasRouteEnhancer::enhance()
File
- src/
Routing/ CasRouteEnhancer.php, line 40
Class
- CasRouteEnhancer
- Class CasRouteEnhancer.
Namespace
Drupal\cas\RoutingCode
public function enhance(array $defaults, Request $request) {
$route = $defaults[RouteObjectInterface::ROUTE_OBJECT];
if ($route
->getPath() == '/user/logout') {
// Replace the logout controller with our own if the logged in user logged
// in using CAS and if we're configured to perform a CAS server logout
// during normal Drupal logouts. Overriding the controller allows us to
// redirect the user to the CAS server logout after logging out locally.
if ($this->settings
->get('logout.cas_logout') && $request
->getSession() && $request
->getSession()
->get('is_cas_user')) {
$defaults['_controller'] = '\\Drupal\\cas\\Controller\\LogoutController::logout';
}
}
return $defaults;
}