GET /users/me
Returns a login {@link User} if the user is authorized. Otherwise, {@code 401 Unauthorized} HTTP
response is sent.
541580
@Get("/users/me")
    public HttpResponse usersMe() throws Exception {
        final User user = AuthUtil.currentUser();
        return HttpResponse.of(HttpStatus.OK, MediaType.JSON_UTF_8,
                               HttpData.of(Jackson.writeValueAsBytes(user)));
    }
1346371
public User getUser(String userName) {
        User result = null;
        for (User item : getUsersList()) {
            if (item.getName().equals(userName)) {
                result = item;
            }
        }
        return result;
    }
1152389
@GET
    @Produces(MediaType.APPLICATION_JSON)
    @Path("/id/{userId}")
    @Description("Returns the user having the given ID.")
    public PrincipalUserDto getUserById(@Context HttpServletRequest req,
        @PathParam("userId") final BigInteger userId) {
        if (userId == null || userId.compareTo(BigInteger.ZERO) < 1) {
            throw new WebApplicationException("User Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST);
        }

        PrincipalUser remoteUser = validateAndGetOwner(req, null);
        PrincipalUser user = _uService.findUserByPrimaryKey(userId);

        if (user != null) {
            super.validateResourceAuthorization(req, user, remoteUser);
            return PrincipalUserDto.transformToDto(user);
        }
        throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND);
    }
619967
public static Object getUser()
    {
        HttpSession session = WebContextFactory.get().getSession(true);
        return session.getAttribute(USER);
    }
708259
@POST
  @Path("me")
  @RolesAllowed({"ROLE_ADMIN", "ROLE_USER"})
  public Response updateMe(@Context HttpServletRequest request,
                           @Context UriInfo uriInfo,
                           @Context SecurityContext securityContext,
                           DUser user) {

    Long userId = (Long) request.getAttribute(OAuth2Filter.NAME_USER_ID);
    if (null == user.getId()) {
      user.setId(userId);
    } else if (!user.getId().equals(userId)) {
      throw new BadRequestRestException("User ids does not match");
    }

    return update(userId, uriInfo, securityContext, user);
  }
463663
@Override
    public PrincipalUser getUser(String username, String password) {
        requireNotDisposed();
        requireArgument(_isUsernameValid(username), MessageFormat.format("Invalid username: {0}", username));

        PrincipalUser result = null;
        String userDn = _findDNForUser(username);

        if (userDn != null && password != null) {
            result = _findPrincipalUser(userDn, username, password);
        }
        return result;
    }
98371
def get_me(self):
        
        response = self.request_json(self.config['me'])
        user = objects.Redditor(self, response['name'], response)
        user.__class__ = objects.LoggedInRedditor
        return user
319625
public com.google.api.Authentication getAuthentication() {
    return authentication_ == null ? com.google.api.Authentication.getDefaultInstance() : authentication_;
  }
1212212
@GET
    @Produces(MediaType.APPLICATION_JSON)
    @Path("/check_oauth_access")
    @Description("Returns redirectURI based on whether this user has previously accepted the authorization page")
    public OAuthAcceptResponseDto checkOauthAccess(@Context HttpServletRequest req) {
        String userName=findUserByToken(req);
        int result = authService.countByUserId(userName);
        OAuthAcceptResponseDto responseDto = new OAuthAcceptResponseDto();
        if (result==0) {
            throw new OAuthException(ResponseCodes.ERR_FINDING_USERNAME, HttpResponseStatus.BAD_REQUEST);
        }
        else {
            responseDto.setRedirectURI(applicationRedirectURI);
            return responseDto;
        }
    }
1011440
protected Subject login() {
		if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
			SibTr.entry(tc, CLASS_NAME + "login");
		}
		Subject subject = null;
		try {
			/*
			 * Only if we have the AuthenticationService running, we can do
			 * Authentication. If it is not present we cannot do any
			 * authentication and hence we have return null, which means
			 * authentication failed
			 */
			if (_authenticationService != null) {
				subject = _authenticationService.authenticate(MESSAGING_JASS_ENTRY_NAME,
						_authenticationData, _partialSubject);
			}
		} catch (AuthenticationException ae) {
			// No FFDC Required. We will throw exception if the subject is Null later
			if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
				SibTr.debug(tc, "EXCEPTION_OCCURED_DURING_AUTHENTICATION_MSE1001");
				SibTr.exception(tc, ae);
			}
		} finally {
			if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
				SibTr.exit(tc, CLASS_NAME + "login");
			}
		}
		return subject;
	}
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
1086942
def get_user(self, key = None):
		'''
		''' 	
		if key:
			uri = self.api_uri + "/users/" + key
		else:
			uri = self.api_uri + "/users/me"

		return self._req('get', uri)
413879
public @CheckForNull User getUser(String name) {
        return User.get(name, User.ALLOW_USER_CREATION_VIA_URL && hasPermission(ADMINISTER));
    }
87179
async def get_me(self) -> types.User:
        
        payload = generate_payload(**locals())

        result = await self.request(api.Methods.GET_ME, payload)
        return types.User(**result)
842515
@SuppressWarnings("serial")
    public Client loginAsOwner() throws APIError {
        requestToken = service.getRequestToken();
        JSONObject token = post("/api/v1/users/login_as_owner", new HashMap<String, Object>() {
            {
                put("request_token", requestToken.getToken());
            }
        });
        if (token != null && !token.getJSONObject("token").isNullObject()) {
            return loginWithAccessToken(token.getJSONObject("token").getString("oauth_token"),
                    token.getJSONObject("token").getString("oauth_token_secret"));
        } else {
            throw new Unauthorized("Could not get Request Token");
        }
    }
1287648
public function getRequestUser()
    {
        if ($this->requestUser === null) {
            $token = $this->getRequestApiToken();
            if ($token === '') {
                $this->requestUser = 'no-token';
            } else {
                $ip = $this->app->make('ip');
                if ($ip->isBanned()) {
                    $this->requestUser = 'banned';
                } else {
                    $requestUser = null;
                    $list = new UserList();
                    $list->disableAutomaticSorting();
                    $list->filterByAttribute('api_token', $token);
                    $ids = $list->getResultIDs();
                    if (!empty($ids)) {
                        $u = \User::getByUserID($ids[0]);
                        if ($u->isRegistered()) {
                            $requestUser = $u;
                        }
                    }
                    if ($requestUser === null) {
                        $this->requestUser == 'invalid-token';
                        $ip->logSignupRequest();
                        if ($ip->signupRequestThreshholdReached()) {
                            $ip->createIPBan();
                        }
                    } else {
                        $this->requestUser = $requestUser;
                    }
                }
            }
        }
        if ($this->requestUser === 'no-token') {
            throw AccessDeniedException::create(t('API Access Token required'));
        }
        if ($this->requestUser === 'banned') {
            throw AccessDeniedException::create($this->app->make('ip')->getErrorMessage());
        }
        if ($this->requestUser === 'invalid-token') {
            throw AccessDeniedException::create(t('Bad API Access Token'));
        }

        return $this->requestUser;
    }
412563
def get_authorization_user(self, **kwargs):
        """"""
        if self.authorization_user is not None:
            return self.authorization_user

        self.authorization_user = self.request.user
        return self.request.user