diff --git a/core/core.services.yml b/core/core.services.yml
index 2ab84ee..9820f0a 100644
--- a/core/core.services.yml
+++ b/core/core.services.yml
@@ -407,7 +407,7 @@ services:
     class: Drupal\Core\Access\CsrfTokenGenerator
     arguments: ['@private_key']
     calls:
-      - [setRequest, ['@?request']]
+      - [setCurrentUser, ['@?current_user']]
   access_manager:
     class: Drupal\Core\Access\AccessManager
     arguments: ['@router.route_provider', '@url_generator', '@paramconverter_manager']
diff --git a/core/lib/Drupal/Core/Access/CsrfTokenGenerator.php b/core/lib/Drupal/Core/Access/CsrfTokenGenerator.php
index 910a77b..b74c05d 100644
--- a/core/lib/Drupal/Core/Access/CsrfTokenGenerator.php
+++ b/core/lib/Drupal/Core/Access/CsrfTokenGenerator.php
@@ -9,7 +9,7 @@
 
 use Drupal\Component\Utility\Crypt;
 use Drupal\Core\PrivateKey;
-use Symfony\Component\HttpFoundation\Request;
+use Drupal\Core\Session\AccountInterface;
 
 /**
  * Generates and validates CSRF tokens.
@@ -26,11 +26,11 @@ class CsrfTokenGenerator {
   protected $privateKey;
 
   /**
-   * The current request object.
+   * The current user.
    *
-   * @var \Symfony\Component\HttpFoundation\Request
+   * @var \Drupal\Core\Session\AccountInterface
    */
-  protected $request;
+  protected $currentUser;
 
   /**
    * Constructs the token generator.
@@ -43,13 +43,13 @@ public function __construct(PrivateKey $private_key) {
   }
 
   /**
-   * Sets the $request property.
+   * Sets the current user.
    *
-   * @param \Symfony\Component\HttpFoundation\Request $request
-   *   The HttpRequest object representing the current request.
+   * @param \Drupal\Core\Session\AccountInterface|null $current_user
+   *  The current user service.
    */
-  public function setRequest(Request $request) {
-    $this->request = $request;
+  public function setCurrentUser(AccountInterface $current_user = NULL) {
+    $this->currentUser = $current_user;
   }
 
   /**
@@ -84,9 +84,7 @@ public function get($value = '') {
    *   is TRUE, the return value will always be TRUE for anonymous users.
    */
   public function validate($token, $value = '', $skip_anonymous = FALSE) {
-    $user = $this->request->attributes->get('_account');
-
-    return ($skip_anonymous && $user->isAnonymous()) || ($token == $this->get($value));
+    return ($skip_anonymous && $this->currentUser->isAnonymous()) || ($token == $this->get($value));
   }
 
 }
diff --git a/core/lib/Drupal/Core/Authentication/AuthenticationManager.php b/core/lib/Drupal/Core/Authentication/AuthenticationManager.php
index f669410..d3630c4 100644
--- a/core/lib/Drupal/Core/Authentication/AuthenticationManager.php
+++ b/core/lib/Drupal/Core/Authentication/AuthenticationManager.php
@@ -110,7 +110,6 @@ public function authenticate(Request $request) {
 
     // Save the authenticated account and the provider that supplied it
     //  for later access.
-    $request->attributes->set('_account', $account);
     $request->attributes->set('_authentication_provider', $this->triggeredProviderId);
 
     // The global $user object is included for backward compatibility only and
diff --git a/core/lib/Drupal/Core/EventSubscriber/SpecialAttributesRouteSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/SpecialAttributesRouteSubscriber.php
index 39f9ceb..3bd54a1 100644
--- a/core/lib/Drupal/Core/EventSubscriber/SpecialAttributesRouteSubscriber.php
+++ b/core/lib/Drupal/Core/EventSubscriber/SpecialAttributesRouteSubscriber.php
@@ -23,7 +23,6 @@ class SpecialAttributesRouteSubscriber extends RouteSubscriberBase {
    */
   protected function alterRoutes(RouteCollection $collection, $module) {
     $special_variables = array(
-      '_account',
       'system_path',
       '_maintenance',
       '_legacy',
diff --git a/core/lib/Drupal/Core/Form/FormBase.php b/core/lib/Drupal/Core/Form/FormBase.php
index 2fad298..42ec8be 100644
--- a/core/lib/Drupal/Core/Form/FormBase.php
+++ b/core/lib/Drupal/Core/Form/FormBase.php
@@ -178,7 +178,7 @@ public function setRequest(Request $request) {
    *   The current user.
    */
   protected function currentUser() {
-    return $this->getRequest()->attributes->get('_account');
+    return \Drupal::currentUser();
   }
 
   /**
diff --git a/core/lib/Drupal/Core/Routing/Enhancer/AuthenticationEnhancer.php b/core/lib/Drupal/Core/Routing/Enhancer/AuthenticationEnhancer.php
index 7012412..6e577b9 100644
--- a/core/lib/Drupal/Core/Routing/Enhancer/AuthenticationEnhancer.php
+++ b/core/lib/Drupal/Core/Routing/Enhancer/AuthenticationEnhancer.php
@@ -55,8 +55,6 @@ public function enhance(array $defaults, Request $request) {
         $anonymous_user = drupal_anonymous_user();
 
         $this->container->set('current_user', $anonymous_user, 'request');
-        // @todo Remove this in https://drupal.org/node/2073531
-        $request->attributes->set('_account', $anonymous_user);
 
         // The global $user object is included for backward compatibility only
         // and should be considered deprecated.
diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module
index f6ab885..e71d71d 100644
--- a/core/modules/comment/comment.module
+++ b/core/modules/comment/comment.module
@@ -1175,9 +1175,7 @@ function comment_load($cid, $reset = FALSE) {
  *   The number of new comments or FALSE if the user is not logged in.
  */
 function comment_num_new($entity_id, $entity_type, $field_name = NULL, $timestamp = 0) {
-  global $user;
-
-  if ($user->isAuthenticated() && \Drupal::moduleHandler()->moduleExists('history')) {
+  if (\Drupal::currentUser()->isAuthenticated() && \Drupal::moduleHandler()->moduleExists('history')) {
     // Retrieve the timestamp at which the current user last viewed this entity.
     if (!$timestamp) {
       if ($entity_type == 'node') {
@@ -1288,11 +1286,11 @@ function comment_get_display_page($cid, $instance) {
  * @param \Drupal\comment\CommentInterface $comment
  */
 function comment_preview(CommentInterface $comment) {
-  global $user;
   $preview_build = array();
   $entity = entity_load($comment->entity_type->value, $comment->entity_id->value);
 
   if (!form_get_errors()) {
+    $user = \Drupal::currentUser();
     // Attach the user and time information.
     if (!empty($comment->name->value)) {
       $account = user_load_by_name($comment->name->value);
@@ -1526,13 +1524,12 @@ function template_preprocess_comment(&$variables) {
 function theme_comment_post_forbidden($variables) {
   $entity = $variables['commented_entity'];
   $field_name = $variables['field_name'];
-  global $user;
 
   // Since this is expensive to compute, we cache it so that a page with many
   // comments only has to query the database once for all the links.
   $authenticated_post_comments = &drupal_static(__FUNCTION__, NULL);
 
-  if ($user->isAnonymous()) {
+  if (\Drupal::currentUser()->isAnonymous()) {
     if (!isset($authenticated_post_comments)) {
       // We only output a link if we are certain that users will get permission
       // to post comments by logging in.
diff --git a/core/modules/comment/lib/Drupal/comment/Entity/Comment.php b/core/modules/comment/lib/Drupal/comment/Entity/Comment.php
index 1db3983..864cd7a 100644
--- a/core/modules/comment/lib/Drupal/comment/Entity/Comment.php
+++ b/core/modules/comment/lib/Drupal/comment/Entity/Comment.php
@@ -216,8 +216,6 @@ public function id() {
   public function preSave(EntityStorageControllerInterface $storage_controller) {
     parent::preSave($storage_controller);
 
-    global $user;
-
     if (!isset($this->status->value)) {
       $this->status->value = user_access('skip comment approval') ? COMMENT_PUBLISHED : COMMENT_NOT_PUBLISHED;
     }
@@ -288,6 +286,7 @@ public function preSave(EntityStorageControllerInterface $storage_controller) {
       }
       // We test the value with '===' because we need to modify anonymous
       // users as well.
+      $user = \Drupal::currentUser();
       if ($this->uid->target_id === $user->id() && $user->isAuthenticated()) {
         $this->name->value = $user->getUsername();
       }
diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NodeNewComments.php b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NodeNewComments.php
index 3e36dff..b12ade0 100644
--- a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NodeNewComments.php
+++ b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NodeNewComments.php
@@ -93,7 +93,7 @@ public function query() {
   }
 
   public function preRender(&$values) {
-    global $user;
+    $user = \Drupal::currentUser();
     if ($user->isAnonymous() || empty($values)) {
       return;
     }
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/Views/CommentTestBase.php b/core/modules/comment/lib/Drupal/comment/Tests/Views/CommentTestBase.php
index 269d2c5..83e34aa 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/Views/CommentTestBase.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/Views/CommentTestBase.php
@@ -36,7 +36,7 @@ function setUp() {
 
     // Add two users, create a node with the user1 as author and another node
     // with user2 as author. For the second node add a comment from user1.
-    $this->account = $this->drupalCreateUser();
+    $this->account = $this->drupalCreateUser(array('skip comment approval'));
     $this->account2 = $this->drupalCreateUser();
     $this->drupalLogin($this->account);
 
diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceSelectionAccessTest.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceSelectionAccessTest.php
index b60198b..98373ae 100644
--- a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceSelectionAccessTest.php
+++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceSelectionAccessTest.php
@@ -119,8 +119,7 @@ public function testNodeHandler() {
 
     // Test as a non-admin.
     $normal_user = $this->drupalCreateUser(array('access content'));
-    $request = $this->container->get('request');
-    $request->attributes->set('_account', $normal_user);
+    $this->container->set('current_user', $normal_user);
     $referenceable_tests = array(
       array(
         'arguments' => array(
@@ -172,7 +171,7 @@ public function testNodeHandler() {
 
     // Test as an admin.
     $admin_user = $this->drupalCreateUser(array('access content', 'bypass node access'));
-    $request->attributes->set('_account', $admin_user);
+    $this->container->set('current_user', $admin_user);
     $referenceable_tests = array(
       array(
         'arguments' => array(
@@ -266,8 +265,7 @@ public function testUserHandler() {
     }
 
     // Test as a non-admin.
-    $request = $this->container->get('request');
-    $request->attributes->set('_account', $users['non_admin']);
+    $this->container->set('current_user', $users['non_admin']);
     $referenceable_tests = array(
       array(
         'arguments' => array(
@@ -306,7 +304,7 @@ public function testUserHandler() {
     );
     $this->assertReferenceable($instance, $referenceable_tests, 'User handler');
 
-    $request->attributes->set('_account', $users['admin']);
+    $this->container->set('current_user', $users['admin']);
     $referenceable_tests = array(
       array(
         'arguments' => array(
@@ -448,8 +446,7 @@ public function testCommentHandler() {
 
     // Test as a non-admin.
     $normal_user = $this->drupalCreateUser(array('access content', 'access comments'));
-    $request = $this->container->get('request');
-    $request->attributes->set('_account', $normal_user);
+    $this->container->set('current_user', $normal_user);
     $referenceable_tests = array(
       array(
         'arguments' => array(
@@ -488,7 +485,7 @@ public function testCommentHandler() {
 
     // Test as a comment admin.
     $admin_user = $this->drupalCreateUser(array('access content', 'access comments', 'administer comments'));
-    $request->attributes->set('_account', $admin_user);
+    $this->container->set('current_user', $admin_user);
     $referenceable_tests = array(
       array(
         'arguments' => array(
@@ -506,7 +503,7 @@ public function testCommentHandler() {
 
     // Test as a node and comment admin.
     $admin_user = $this->drupalCreateUser(array('access content', 'access comments', 'administer comments', 'bypass node access'));
-    $request->attributes->set('_account', $admin_user);
+    $this->container->set('current_user', $admin_user);
     $referenceable_tests = array(
       array(
         'arguments' => array(
diff --git a/core/modules/node/node.module b/core/modules/node/node.module
index 4bed03f..d18c336 100644
--- a/core/modules/node/node.module
+++ b/core/modules/node/node.module
@@ -276,10 +276,9 @@ function node_title_list($result, $title = NULL) {
  *   One of the MARK constants.
  */
 function node_mark($nid, $timestamp) {
-  global $user;
   $cache = &drupal_static(__FUNCTION__, array());
 
-  if ($user->isAnonymous() || !\Drupal::moduleHandler()->moduleExists('history')) {
+  if (\Drupal::currentUser()->isAnonymous() || !\Drupal::moduleHandler()->moduleExists('history')) {
     return MARK_READ;
   }
   if (!isset($cache[$nid])) {
@@ -1700,9 +1699,8 @@ function node_access_grants($op, $account = NULL) {
  * @see node_query_node_access_alter()
  */
 function node_access_view_all_nodes($account = NULL) {
-  global $user;
   if (!$account) {
-    $account = $user;
+    $account = \Drupal::currentUser();
   }
 
   // Statically cache results in an array keyed by $account->id().
@@ -1740,11 +1738,9 @@ function node_access_view_all_nodes($account = NULL) {
  * @endcode
  */
 function node_query_node_access_alter(AlterableInterface $query) {
-  global $user;
-
   // Read meta-data from query, if provided.
   if (!$account = $query->getMetaData('account')) {
-    $account = $user;
+    $account = \Drupal::currentUser();
   }
   if (!$op = $query->getMetaData('op')) {
     $op = 'view';
diff --git a/core/modules/search/lib/Drupal/search/Plugin/SearchInterface.php b/core/modules/search/lib/Drupal/search/Plugin/SearchInterface.php
index 21478fe..c473838 100644
--- a/core/modules/search/lib/Drupal/search/Plugin/SearchInterface.php
+++ b/core/modules/search/lib/Drupal/search/Plugin/SearchInterface.php
@@ -23,9 +23,7 @@
    *   Array of parameters as am associative array. This is expected to
    *   be the query string from the current request.
    * @param array $attributes
-   *   Array of attributes, usually from the current request object. The search
-   *   plugin may use the '_account' attribute if present to personalize the
-   *   search, or use attributes from the current route variables.
+   *   Array of attributes, usually from the current request object.
    *
    * @return \Drupal\search\Plugin\SearchInterface
    *   A search plugin object for chaining.
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
index d0edfec..3c24375 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
@@ -897,7 +897,7 @@ protected function changeDatabasePrefix() {
    * @see TestBase::tearDown()
    */
   protected function prepareEnvironment() {
-    global $user, $conf;
+    global $conf;
     $language_interface = language(Language::TYPE_INTERFACE);
 
     // When running the test runner within a test, back up the original database
@@ -925,6 +925,7 @@ protected function prepareEnvironment() {
     // simpletest directory if a test is executed within a test.
     $this->originalFileDirectory = settings()->get('file_public_path', conf_path() . '/files');
     $this->originalProfile = drupal_get_profile();
+    $this->originalUser = \Drupal::currentUser();
     $this->originalUser = isset($user) ? clone $user : NULL;
 
     // Ensure that the current session is not changed by the new environment.
@@ -932,7 +933,7 @@ protected function prepareEnvironment() {
     drupal_save_session(FALSE);
     // Run all tests as a anonymous user by default, web tests will replace that
     // during the test set up.
-    $user = drupal_anonymous_user();
+    \Drupal::getContainer()->set('current_user', drupal_anonymous_user());
 
     // Save and clean the shutdown callbacks array because it is static cached
     // and will be changed by the test run. Otherwise it will contain callbacks
@@ -1040,8 +1041,6 @@ protected function rebuildContainer() {
     // DrupalKernel replaces the container in \Drupal::getContainer() with a
     // different object, so we need to replace the instance on this test class.
     $this->container = \Drupal::getContainer();
-    // The global $user is set in TestBase::prepareEnvironment().
-    $this->container->get('request')->attributes->set('_account', $GLOBALS['user']);
   }
 
   /**
@@ -1056,7 +1055,7 @@ protected function rebuildContainer() {
    * @see TestBase::prepareEnvironment()
    */
   protected function tearDown() {
-    global $user, $conf;
+    global $conf;
 
     // Reset all static variables.
     // Unsetting static variables will potentially invoke destruct methods,
@@ -1134,7 +1133,7 @@ protected function tearDown() {
     $callbacks = $this->originalShutdownCallbacks;
 
     // Restore original user session.
-    $user = $this->originalUser;
+    \Drupal::getContainer()->set('current_user', $this->originalUser);
     drupal_save_session(TRUE);
   }
 
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
index a4c7b27..ac5b009 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
@@ -277,8 +277,7 @@ protected function drupalCreateNode(array $settings = array()) {
         $settings['uid'] = $this->loggedInUser->id();
       }
       else {
-        global $user;
-        $settings['uid'] = $user->id();
+        $settings['uid'] = \Drupal::currentUser()->id();
       }
     }
 
@@ -714,7 +713,7 @@ protected function drupalLogout() {
    * @see \Drupal\simpletest\WebTestBase::prepareEnvironment()
    */
   protected function setUp() {
-    global $user, $conf;
+    global $conf;
 
     // When running tests through the Simpletest UI (vs. on the command line),
     // Simpletest's batch conflicts with the installer's batch. Batch API does
diff --git a/core/modules/system/tests/modules/router_test_directory/lib/Drupal/router_test/TestContent.php b/core/modules/system/tests/modules/router_test_directory/lib/Drupal/router_test/TestContent.php
index a4ed1ec..71d095c 100644
--- a/core/modules/system/tests/modules/router_test_directory/lib/Drupal/router_test/TestContent.php
+++ b/core/modules/system/tests/modules/router_test_directory/lib/Drupal/router_test/TestContent.php
@@ -55,7 +55,7 @@ public function test1() {
    *   The user name of the current logged in user.
    */
   public function test11() {
-    $account  = \Drupal::request()->attributes->get('_account');
+    $account = \Drupal::currentUser();
     return $account->getUsername();
   }
 
diff --git a/core/modules/user/lib/Drupal/user/Plugin/Search/UserSearch.php b/core/modules/user/lib/Drupal/user/Plugin/Search/UserSearch.php
index 8e5b336..3921dcb 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/Search/UserSearch.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/Search/UserSearch.php
@@ -51,11 +51,11 @@ class UserSearch extends SearchPluginBase implements AccessibleInterface {
   protected $moduleHandler;
 
   /**
-   * The current request.
+   * The current user.
    *
-   * @var \Symfony\Component\HttpFoundation\Request
+   * @var \Drupal\Core\Session\AccountInterface
    */
-  protected $request;
+  protected $currentUser;
 
   /**
    * {@inheritdoc}
@@ -65,7 +65,7 @@ static public function create(ContainerInterface $container, array $configuratio
       $container->get('database'),
       $container->get('plugin.manager.entity'),
       $container->get('module_handler'),
-      $container->get('request'),
+      $container->get('current_user'),
       $configuration,
       $plugin_id,
       $plugin_definition
@@ -81,8 +81,8 @@ static public function create(ContainerInterface $container, array $configuratio
    *   The entity manager.
    * @param ModuleHandlerInterface $module_handler
    *   The module handler.
-   * @param \Symfony\Component\HttpFoundation\Request $request
-   *   The current request.
+   * @param \Drupal\Core\Session\AccountInterface $current_user
+   *   The current user.
    * @param array $configuration
    *   A configuration array containing information about the plugin instance.
    * @param string $plugin_id
@@ -90,11 +90,11 @@ static public function create(ContainerInterface $container, array $configuratio
    * @param array $plugin_definition
    *   The plugin implementation definition.
    */
-  public function __construct(Connection $database, EntityManagerInterface $entity_manager, ModuleHandlerInterface $module_handler, Request $request, array $configuration, $plugin_id, array $plugin_definition) {
+  public function __construct(Connection $database, EntityManagerInterface $entity_manager, ModuleHandlerInterface $module_handler, AccountInterface $current_user, array $configuration, $plugin_id, array $plugin_definition) {
     $this->database = $database;
     $this->entityManager = $entity_manager;
     $this->moduleHandler = $module_handler;
-    $this->request = $request;
+    $this->currentUser = $current_user;
     parent::__construct($configuration, $plugin_id, $plugin_definition);
   }
 
@@ -120,8 +120,7 @@ public function execute() {
       ->select('users')
       ->extend('Drupal\Core\Database\Query\PagerSelectExtender');
     $query->fields('users', array('uid'));
-    $user_account = $this->request->attributes->get('_account');
-    if ($user_account->hasPermission('administer users')) {
+    if ($this->currentUser->hasPermission('administer users')) {
       // Administrators can also search in the otherwise private email field, and
       // they don't need to be restricted to only active users.
       $query->fields('users', array('mail'));
@@ -147,7 +146,7 @@ public function execute() {
         'title' => $account->getUsername(),
         'link' => url('user/' . $account->id(), array('absolute' => TRUE)),
       );
-      if ($user_account->hasPermission('administer users')) {
+      if ($this->currentUser->hasPermission('administer users')) {
         $result['title'] .= ' (' . $account->getEmail() . ')';
       }
       $results[] = $result;
diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/argument_default/CurrentUser.php b/core/modules/user/lib/Drupal/user/Plugin/views/argument_default/CurrentUser.php
index 024f40d..652a557 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/views/argument_default/CurrentUser.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/views/argument_default/CurrentUser.php
@@ -24,8 +24,7 @@
 class CurrentUser extends ArgumentDefaultPluginBase {
 
   public function getArgument() {
-    global $user;
-    return $user->id();
+    return \Drupal::currentUser()->id();
   }
 
 }
diff --git a/core/modules/user/lib/Drupal/user/RegisterFormController.php b/core/modules/user/lib/Drupal/user/RegisterFormController.php
index 6ace140..e36b291 100644
--- a/core/modules/user/lib/Drupal/user/RegisterFormController.php
+++ b/core/modules/user/lib/Drupal/user/RegisterFormController.php
@@ -18,7 +18,6 @@ class RegisterFormController extends AccountFormController {
    * Overrides Drupal\Core\Entity\EntityFormController::form().
    */
   public function form(array $form, array &$form_state) {
-    global $user;
     $account = $this->entity;
 
     $admin = user_access('administer users');
@@ -32,6 +31,7 @@ public function form(array $form, array &$form_state) {
     );
 
     // If we aren't admin but already logged on, go to the user page instead.
+    $user = \Drupal::currentUser();
     if (!$admin && $user->isAuthenticated()) {
       return new RedirectResponse(url('user/' . $user->id(), array('absolute' => TRUE)));
     }
diff --git a/core/modules/user/lib/Drupal/user/Tests/Views/ArgumentDefaultTest.php b/core/modules/user/lib/Drupal/user/Tests/Views/ArgumentDefaultTest.php
index 654d1d7..a5e9908 100644
--- a/core/modules/user/lib/Drupal/user/Tests/Views/ArgumentDefaultTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/Views/ArgumentDefaultTest.php
@@ -33,17 +33,16 @@ public function test_plugin_argument_default_current_user() {
 
     // Switch the user, we have to check the global user too, because drupalLogin is only for the simpletest browser.
     $this->drupalLogin($account);
-    global $user;
-    $admin = $user;
+    $admin = \Drupal::currentUser();
     drupal_save_session(FALSE);
-    $user = $account;
+    \Drupal::getContainer()->set('current_user', $account);
 
     $view = views_get_view('test_plugin_argument_default_current_user');
     $view->initHandlers();
 
     $this->assertEqual($view->argument['null']->getDefaultArgument(), $account->id(), 'Uid of the current user is used.');
     // Switch back.
-    $user = $admin;
+    \Drupal::getContainer()->set('current_user', $admin);
     drupal_save_session(TRUE);
   }
 
diff --git a/core/modules/user/lib/Drupal/user/Tests/Views/HandlerFieldUserNameTest.php b/core/modules/user/lib/Drupal/user/Tests/Views/HandlerFieldUserNameTest.php
index 99659a7..1ec2c8b 100644
--- a/core/modules/user/lib/Drupal/user/Tests/Views/HandlerFieldUserNameTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/Views/HandlerFieldUserNameTest.php
@@ -30,6 +30,8 @@ public static function getInfo() {
   }
 
   public function testUserName() {
+    $this->drupalLogin($this->drupalCreateUser(array('access user profiles')));
+
     $view = views_get_view('test_views_handler_field_user_name');
     $this->executeView($view);
 
diff --git a/core/modules/user/user.install b/core/modules/user/user.install
index 9d25ccc..7960534 100644
--- a/core/modules/user/user.install
+++ b/core/modules/user/user.install
@@ -616,8 +616,6 @@ function user_update_8009(&$sandbox) {
  * Create user picture field.
  */
 function user_update_8011() {
-  global $user;
-
   // User pictures can only be migrated to the new user picture image field
   // if Image module is installed.
   if (!\Drupal::moduleHandler()->moduleExists('image')) {
@@ -648,7 +646,7 @@ function user_update_8011() {
         'uri' => $destination,
       ))
       ->fields(array(
-        'uid' => $user->id(),
+        'uid' => \Drupal::currentUser()->id(),
         'status' => FILE_STATUS_PERMANENT,
         'filename' => drupal_basename($destination),
         'uuid' => $uuid->generate(),
diff --git a/core/modules/user/user.module b/core/modules/user/user.module
index 83baa54..6486f91 100644
--- a/core/modules/user/user.module
+++ b/core/modules/user/user.module
@@ -447,12 +447,10 @@ function _user_role_permissions_update($roles) {
  *   \Drupal\Core\Session\AccountInterface::hasPermission()
  */
 function user_access($string, AccountInterface $account = NULL) {
-  global $user;
-
   if (!isset($account)) {
     // In the installer request session is not set, so we have to fall back
     // to the global $user. In all other cases the session key is preferred.
-    $account = \Drupal::request()->attributes->get('_account') ?: $user;
+    $account = \Drupal::currentUser() ?: $GLOBALS['user'];
   }
 
   return $account->hasPermission($string);
@@ -602,7 +600,7 @@ function user_format_name(AccountInterface $account) {
  * @see user_user_logout()
  */
 function user_template_preprocess_default_variables_alter(&$variables) {
-  global $user;
+  $user = \Drupal::currentUser();
 
   // If this function is called from the installer after Drupal has been
   // installed then $user will not be set.
@@ -1005,6 +1003,7 @@ function user_authenticate($name, $password) {
  * @see hook_user_login()
  */
 function user_login_finalize(UserInterface $account) {
+  \Drupal::getContainer()->set('current_user', $account);
   global $user;
   $user = $account;
   watchdog('user', 'Session opened for %name.', array('%name' => $user->getUsername()));
@@ -1136,8 +1135,6 @@ function user_pass_rehash($password, $timestamp, $login) {
  * @see _user_cancel()
  */
 function user_cancel($edit, $uid, $method) {
-  global $user;
-
   $account = user_load($uid);
 
   if (!$account) {
@@ -1170,7 +1167,7 @@ function user_cancel($edit, $uid, $method) {
   );
 
   // After cancelling account, ensure that user is logged out.
-  if ($account->id() == $user->id()) {
+  if ($account->id() == \Drupal::currentUser()->id()) {
     // Batch API stores data in the session, so use the finished operation to
     // manipulate the current user's session id.
     $batch['finished'] = '_user_cancel_session_regenerate';
@@ -1191,8 +1188,6 @@ function user_cancel($edit, $uid, $method) {
  * @see user_cancel()
  */
 function _user_cancel($edit, $account, $method) {
-  global $user;
-
   switch ($method) {
     case 'user_cancel_block':
     case 'user_cancel_block_unpublish':
@@ -1223,8 +1218,8 @@ function _user_cancel($edit, $account, $method) {
   // their session though, as we might have information in it, and we can't
   // regenerate it because batch API uses the session ID, we will regenerate it
   // in _user_cancel_session_regenerate().
-  if ($account->id() == $user->id()) {
-    $user = drupal_anonymous_user();
+  if ($account->id() == \Drupal::currentUser()->id()) {
+    \Drupal::getContainer()->set('current_user', drupal_anonymous_user());
   }
 
   // Clear the cache for anonymous users.
@@ -1272,7 +1267,7 @@ function user_cancel_methods() {
     'user_cancel_delete' => array(
       'title' => t('Delete the account and its content.'),
       'description' => t('Your account will be removed and all account information deleted. All of your content will also be deleted.'),
-      'access' => \Drupal::request()->attributes->get('_account')->hasPermission('administer users'),
+      'access' => \Drupal::currentUser()->hasPermission('administer users'),
     ),
   );
   // Allow modules to customize account cancellation methods.
@@ -1750,8 +1745,6 @@ function user_form_process_password_confirm($element) {
   );
 
   if (\Drupal::config('user.settings')->get('password_strength')) {
-
-    global $user;
     $password_settings['showStrengthIndicator'] = TRUE;
     $password_settings += array(
       'strengthTitle' => t('Password strength:'),
@@ -1766,7 +1759,7 @@ function user_form_process_password_confirm($element) {
       'fair' => t('Fair'),
       'good' => t('Good'),
       'strong' => t('Strong'),
-      'username' => $user->getUsername(),
+      'username' => \Drupal::currentUser()->getUsername(),
     );
   }
 
@@ -1871,7 +1864,7 @@ function user_file_download_access($field, EntityInterface $entity, File $file)
  * Implements hook_toolbar().
  */
 function user_toolbar() {
-  global $user;
+  $user = \Drupal::currentUser();
 
   // Add logout & user account links or login link.
   if ($user->isAuthenticated()) {
@@ -1990,7 +1983,7 @@ function user_library_info() {
  * Logs the current user out.
  */
 function user_logout() {
-  global $user;
+  $user = \Drupal::currentUser();
 
   watchdog('user', 'Session closed for %name.', array('%name' => $user->getUsername()));
 
diff --git a/core/modules/user/user.pages.inc b/core/modules/user/user.pages.inc
index 2977253..c4425b9 100644
--- a/core/modules/user/user.pages.inc
+++ b/core/modules/user/user.pages.inc
@@ -17,7 +17,7 @@
  * @deprecated Use \Drupal\user\Form\UserForm::resetPass()
  */
 function user_pass_reset($form, &$form_state, $uid, $timestamp, $hashed_pass, $action = NULL) {
-  global $user;
+  $user = \Drupal::currentUser();
 
   // When processing the one-time login link, we have to make sure that a user
   // isn't already logged in.
diff --git a/core/modules/user/user.views_execution.inc b/core/modules/user/user.views_execution.inc
index 622cdbf..c9a3f1d 100644
--- a/core/modules/user/user.views_execution.inc
+++ b/core/modules/user/user.views_execution.inc
@@ -13,6 +13,5 @@
  * Allow replacement of current userid so we can cache these queries.
  */
 function user_views_query_substitutions(ViewExecutable $view) {
-  global $user;
-  return array('***CURRENT_USER***' => $user->id());
+  return array('***CURRENT_USER***' => \Drupal::currentUser()->id());
 }
diff --git a/core/tests/Drupal/Tests/Core/Access/CsrfTokenGeneratorTest.php b/core/tests/Drupal/Tests/Core/Access/CsrfTokenGeneratorTest.php
index aa058bb..5b823a2 100644
--- a/core/tests/Drupal/Tests/Core/Access/CsrfTokenGeneratorTest.php
+++ b/core/tests/Drupal/Tests/Core/Access/CsrfTokenGeneratorTest.php
@@ -49,7 +49,6 @@ function setUp() {
       ->will($this->returnValue($this->key));
 
     $this->generator = new CsrfTokenGenerator($private_key);
-    $this->generator->setRequest(new Request());
   }
 
   /**
@@ -79,18 +78,14 @@ public function testValidate() {
     $account->expects($this->once())
       ->method('isAnonymous')
       ->will($this->returnValue(TRUE));
-    $request = new Request();
-    $request->attributes->set('_account', $account);
-    $this->generator->setRequest($request);
+    $this->generator->setCurrentUser($account);
     $this->assertTrue($this->generator->validate($token, 'foo', TRUE));
 
     $account = $this->getMock('Drupal\Core\Session\AccountInterface');
     $account->expects($this->once())
       ->method('isAnonymous')
       ->will($this->returnValue(FALSE));
-    $request = new Request();
-    $request->attributes->set('_account', $account);
-    $this->generator->setRequest($request);
+    $this->generator->setCurrentUser($account);
 
     $this->assertFalse($this->generator->validate($token, 'foo', TRUE));
   }
diff --git a/core/tests/Drupal/Tests/Core/EventSubscriber/SpecialAttributesRouteSubscriberTest.php b/core/tests/Drupal/Tests/Core/EventSubscriber/SpecialAttributesRouteSubscriberTest.php
index f003327..0bb5006 100644
--- a/core/tests/Drupal/Tests/Core/EventSubscriber/SpecialAttributesRouteSubscriberTest.php
+++ b/core/tests/Drupal/Tests/Core/EventSubscriber/SpecialAttributesRouteSubscriberTest.php
@@ -53,7 +53,6 @@ protected function setUp() {
    */
   public function providerTestOnRouteBuildingInvalidVariables() {
     $routes = array();
-    $routes[] = array(new Route('/test/{_account}'));
     $routes[] = array(new Route('/test/{system_path}'));
     $routes[] = array(new Route('/test/{_maintenance}'));
     $routes[] = array(new Route('/test/{_legacy}'));
