/** * {@inheritdoc} */ public function authenticate(Request $request) { $username = CosignSharedFunctions::cosign_retrieve_remote_user(); if ($user = CosignSharedFunctions::cosign_user_status($username)) { return $user; } else { if (!CosignSharedFunctions::cosign_is_friend_account($username)) { drupal_set_message(t('This site is restricted. You may try <a href="/user/login">logging in to cosign</a>.'), 'error'); } throw new AccessDeniedHttpException(); return null; } }
public function cosign_logout(Request $request) { $uname = \Drupal::currentUser()->getAccountName(); if (\Drupal::config('cosign.settings')->get('cosign_allow_cosign_anons') == 0 || CosignSharedFunctions::cosign_is_friend_account($uname) && \Drupal::config('cosign.settings')->get('cosign_allow_friend_accounts') == 0) { $response = CosignController::cosign_cosignlogout(); } else { if (isset($_SERVER['HTTP_REFERER'])) { $referrer = $_SERVER['HTTP_REFERER']; } else { global $base_path; $referrer = $base_path; } //$response = new RedirectResponse($referrer); //TODO - use $link = Link::fromTextAndUrl($text, $url); $response = array('#type' => 'markup', '#title' => 'Browsing anonymously with cosign is enabled.', '#markup' => t('<p>To log out of cosign go to <a href="/cosign/logout">cosign/logout</a>.</p><p>To return where you were go to <a href="' . $referrer . '">' . $referrer . '</a>.</p>')); } user_logout(); return $response; }