function QueryParameterWorkspaceNegotiator::getActiveWorkspaceId
Same name in other branches
- 10 core/modules/workspaces/src/Negotiator/QueryParameterWorkspaceNegotiator.php \Drupal\workspaces\Negotiator\QueryParameterWorkspaceNegotiator::getActiveWorkspaceId()
Overrides SessionWorkspaceNegotiator::getActiveWorkspaceId
File
-
core/
modules/ workspaces/ src/ Negotiator/ QueryParameterWorkspaceNegotiator.php, line 26
Class
- QueryParameterWorkspaceNegotiator
- Defines the query parameter workspace negotiator.
Namespace
Drupal\workspaces\NegotiatorCode
public function getActiveWorkspaceId(Request $request) : ?string {
$workspace_id = (string) $request->query
->get('workspace');
$token = (string) $request->query
->get('token');
$is_valid_token = hash_equals($this->getQueryToken($workspace_id), $token);
// This negotiator receives a workspace ID from user input, so a minimal
// validation is needed to ensure that we protect against fake input before
// the workspace manager fully validates the negotiated workspace ID.
// @see \Drupal\workspaces\WorkspaceManager::getActiveWorkspace()
return $is_valid_token ? $workspace_id : NULL;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.