You are here

public function MainController::tasteGingerbreadCookie in Bakery Single Sign-On System 8.2

Validate the account information request.

File

src/Controller/MainController.php, line 103
Router call back functions for bakery SSO functions.

Class

MainController
Route callback functionlities.

Namespace

Drupal\bakery\Controller

Code

public function tasteGingerbreadCookie(Request $request = NULL) {

  // Work around https://www.drupal.org/project/drupal/issues/2786941
  $request = $request ?? \Drupal::request();
  $type = 'gingerbread';
  $post = $request->request;
  if (!$post
    ->has($type)) {
    return AccessResult::forbidden();
  }
  $cookie = $this->kitchen
    ->tasteData($post
    ->get($type), $type);
  if ($cookie === FALSE) {
    return AccessResult::forbidden();
  }
  $request->attributes
    ->set('bakery', $cookie);
  return AccessResult::allowed();
}