@ngdoc object

@name stormpath.userService.$user

@description

Use this service to get the current user and do access control checks
on the user.
340008
function User(data){
    var self = this;
    Object.keys(data).map(function(k){
      self[k] = data[k];
    });
  }
622025
def get_user(user=None):
    
    if user is None:
        # Return the current authenticated user
        user = getSecurityManager().getUser()
    elif isinstance(user, MemberData):
        # MemberData wrapped user -> get the user object
        user = user.getUser()
    elif isinstance(user, basestring):
        # User ID -> get the user
        user = get_member_by_login_name(get_portal(), user, False)
        if user:
            user = user.getUser()
    return user
731087
def get_user
        if params[:id] == "current"
          raise ApplicationController::UNAUTHORIZED_ERROR if @auth_user.nil?
          params[:id] = @auth_user.uuid
        end
        @user = find_object(User, params[:id])
        authorize_for!(@user)
        return @user
      end
625315
public function getUser() {

		// Find user having email or username
		if( empty( $this->user ) ) {

			$this->user = $this->userService->getByEmail( $this->email );

			if( empty( $this->user ) ) {

				$this->user = $this->userService->getByUsername( $this->email );
			}
		}

		return $this->user;
	}
332445
def get_user(self, user):
        
        self.project_service.set_auth(self._token_project)
        return self.project_service.get_user(user)
1012681
public function user()
    {
        if (!is_null($this->user)) {
            return $this->user;
        }

        if ($this->jwt->setRequest($this->request)->getToken() && $this->jwt->check()) {
            $id = $this->jwt->payload()->get('sub');

            return $this->user = $this->provider->retrieveById($id);
        }
    }
65146
function() {
        var user = userStore.getUser();
        if (user) {
          $rootScope.user = user;
          authLogger.log('AuthService.withUser()', user);
          return $q.when(user);
        } else {
          authLogger.log('AuthService.withUser(), calling startLogin()');
          return this.startLogin();
        }
      }
914801
public function user($user = null)
    {
        if ($user !== null) {
            $this->user = $user;
        }

        return $this->user;
    }
718908
public function getAuthor()
    {
        $user = null;

        if($this->hasProperty('created_by') && !empty($this->created_by)) {
            $user = $this->getObject('user.provider')->getUser($this->created_by);
        }

        return $user;
    }
989471
public static function getCurrent()
    {
        if (empty(self::$current)) {
            Logger::get()->debug('Checking session for users...');
            self::$current = static::getInstance()->getFromSession();

            // Nothing there, new visitor then.
            if (empty(self::$current)) {
                throw new \RuntimeException('Unable to obtain a user');
            }

            // Update last seen time.
            self::$current->lastSeen = new \DateTime;

            Logger::get()->debug(
                'Current user is ' . self::$current->getId()
            );
        }

        return self::$current;
    }
1354546
public function me(): User
    {
        // Result is different - denormalize by hand
        $data = $this->getClient()->call(null, null, self::ENDPOINT, null, false, 'GET');

        return $this->getClient()->denormalizeObject(User::class, [$data], false);
    }
462063
public function user()
    {
        // if the user was explicitly marked as logged out.
        if ($this->loggedOut) {
            // just return null.
            return null;
        }

        // if the user is already set.
        if ($this->user) {
            return $this->user;
        }

        // detects a token presence.
        $token = $this->detectedToken();

        // if the received token is not actually valid.
        if (!$token || !$this->manager->validToken($token)) {
            // also return null since the token
            // signature could not be determined.
            return null;
        }

        // if the token has expired.
        if ($this->manager->expired($token)) {
            // you got right?
            return null;
        }

        // try to find the user which the token belongs to.
        $user = $this->findUserByToken($token);

        // if the user has not been found.
        if (!$user) {
            // abort!
            return null;
        }

        // set the current user on the scope.
        $this->setUser($user);

        // return the scope user.
        return $this->user;
    }
1041910
public function user()
    {
        // If we've already retrieved the user for the current request we can just
        // return it back immediately. We do not want to fetch the user data on
        // every call to this method because that would be tremendously slow.
        if (! is_null($this->user)) {
            return $this->user;
        }

        $user = null;

        $token = $this->getTokenForRequest();

        if (! empty($token)) {
            $user = $this->provider->retrieveByCredentials(
                array($this->storageKey => $token)
            );
        }

        return $this->user = $user;
    }
1086984
@GET
  @Path("/db/{authorizerName}/users/{userName}")
  @Produces(MediaType.APPLICATION_JSON)
  @Consumes(MediaType.APPLICATION_JSON)
  @ResourceFilters(BasicSecurityResourceFilter.class)
  public Response getUser(
      @Context HttpServletRequest req,
      @PathParam("authorizerName") final String authorizerName,
      @PathParam("userName") final String userName,
      @QueryParam("full") String full
  )
  {
    return resourceHandler.getUser(authorizerName, userName, full != null);
  }
1033928
public function user()
    {
        if (self::$authorizedUser || !$_GET['state'] || (!$code = $_GET['code']) && $_GET['state']) {
            return self::$authorizedUser;
        }

        $permission = $this->getAccessPermission($code);

        if ($permission['scope'] !== 'snsapi_userinfo') {
            $user = ['openid' => $permission['openid']];
        } else {
            $user = $this->getUser($permission['openid'], $permission['access_token']);
        }

        return $this->authorizedUser = $user;
    }
718105
public function getUser()
    {
        /** @var TokenInterface $token */
        $token = $this->application['security.token_storage']->getToken();
        if (null === $token) {
            return null;
        }

        $user = $token->getUser();
        if (!is_object($user)) {
            return null;
        }

        return $user;
    }
207776
public function getUser()
    {
        if (null === $token = $this->securityContext->getToken()) {
            return;
        }

        if (!is_object($user = $token->getUser())) {
            return;
        }

        return $user;
    }