Returns a command that retrieves the current logged user based on secure cookie
    If there is no logged user, the result from command is None
552379
def logged_user(request):
    
    dct = cookie_facade.retrive_cookie_data(request, USER_COOKIE_NAME).execute().result
    if dct is None:
        return Command()
    return NodeSearch(dct['id'])
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
218835
function getCookie() {
  if (document.cookie.indexOf(`${disableStr}=true`) > -1) {
    return true;
  } else if (document.cookie.indexOf(`${disableStr}=false`) > -1) {
    return false;
  }

  return null;
}
890506
def get_cookie_value(self, cookie=None, cookie_name=None):
        
        if cookie_name is None:
            cookie_name = self.default_value['name']

        if cookie is None or cookie_name is None:
            return None
        else:
            try:
                info, timestamp = parse_cookie(cookie_name, self.sign_key, cookie,
                                               self.enc_key, self.sign_alg)
            except (TypeError, AssertionError):
                return None
            else:
                value, _ts, typ = info.split("::")
                if timestamp == _ts:
                    return value, _ts, typ
        return None
60624
function get(ignored, cb) {
  assert(this.$session);
  const ugRequest = {
    userId: this.$session.userId,
  };
  this.syscall('UserManager', 'get', ugRequest, (err, userInfo, curVersion) => {
    if (err) return cb(err);

    // Strip security-sensitive information.
    delete userInfo.hashedPassword;
    _.forEach(userInfo.securityEvents, (secEvt) => {
      if (secEvt.eventType === 'password_reset_requested') {
        delete secEvt.data.resetCode;
      }
    });

    return cb(null, userInfo, curVersion);
  });
}
524025
def _get_auth(self, user=None, password=None):
        
        fn = os.path.expanduser(AUTH_FILE)
        if os.path.exists(fn):
            for i, line in enumerate(csv.reader(open(fn))):
                if len(line) != 3:
                    log.warning("Cannot parse line {i} in {fn}".format(**locals()))
                    continue
                hostname, username, pwd = line
                if (hostname in ("", "*", self.host)
                    and (user is None or username == user)):
                    return (username, pwd)
        if user is None:
            user = os.environ.get("AMCAT_USER", os.environ.get("USER"))
        if password is None:
            password = os.environ.get("AMCAT_PASSWORD")
        if user is None or password is None:
            raise Exception("No authentication info for {user}@{self.host} "
                            "from {fn} or AMCAT_USER / AMCAT_PASSWORD "
                            "variables".format(**locals()))
        return user, password
652973
def _prepare_cookies(self, command, url):
        

        req = requests.models.Request()
        req.method = 'GET'
        req.url = url

        cookie_values = requests.cookies.get_cookie_header(
            self.session.cookies, req)

        if cookie_values:
            self._add_cookies(command, cookie_values)
476844
def get_user(self, username):
        
        cmd = ["glsuser", "-u", username, "--raw"]
        results = self._read_output(cmd)

        if len(results) == 0:
            return None
        elif len(results) > 1:
            logger.error(
                "Command returned multiple results for '%s'." % username)
            raise RuntimeError(
                "Command returned multiple results for '%s'." % username)

        the_result = results[0]
        the_name = the_result["Name"]
        if username.lower() != the_name.lower():
            logger.error(
                "We expected username '%s' but got username '%s'."
                % (username, the_name))
            raise RuntimeError(
                "We expected username '%s' but got username '%s'."
                % (username, the_name))

        return the_result
418551
def connect_current_user=(user)
      @connect_current_user = user || User.anonymous
      @app_current_user = user_provider.connect_user_to_app_user(@connect_current_user)

      if @connect_current_user.is_anonymous?
        @session[:user_id] = nil
        @cookies.delete(:secure_user_id)
      else
        @session[:user_id] = @connect_current_user.id
        @cookies.signed[:secure_user_id] = {secure: true, value: "secure#{@connect_current_user.id}"}
      end

      @connect_current_user
    end
1229231
def _get_cookie(self, name, domain):
        ''' 
        '''
        for c in self.session.cookies:
            if c.name==name and c.domain==domain:
                return c
        return None
1282562
def get(self, request):
        """"""

        nonce = request.session.get('oidc_nonce')
        if nonce:
            # Make sure that nonce is not used twice
            del request.session['oidc_nonce']

        if request.GET.get('error'):
            # Ouch! Something important failed.
            # Make sure the user doesn't get to continue to be logged in
            # otherwise the refresh middleware will force the user to
            # redirect to authorize again if the session refresh has
            # expired.
            if is_authenticated(request.user):
                auth.logout(request)
            assert not is_authenticated(request.user)
        elif 'code' in request.GET and 'state' in request.GET:
            kwargs = {
                'request': request,
                'nonce': nonce,
            }

            if 'oidc_state' not in request.session:
                return self.login_failure()

            if request.GET['state'] != request.session['oidc_state']:
                msg = 'Session `oidc_state` does not match the OIDC callback state'
                raise SuspiciousOperation(msg)

            self.user = auth.authenticate(**kwargs)

            if self.user and self.user.is_active:
                return self.login_success()
        return self.login_failure()
850827
private String getPathInfoforSecureloginlogout(String currentURI, String securityString) {
        String pathInfo = null;
        int lastIndex_Security = currentURI.lastIndexOf(securityString);
        String restURI = currentURI.substring(lastIndex_Security + securityString.length());

        if (restURI.equals(""))
            pathInfo = null;
        else
            pathInfo = restURI;
        return pathInfo;
    }
338383
def _check_logged_user(self):
        """"""
        if not self._env or not self._password or not self._login:
            raise error.InternalError("Login required")
1046473
def get_user_if_exists(strategy, details, user=None, *args, **kwargs):
    """"""
    if user:
        return {'is_new': False}
    try:
        username = details.get('username')

        # Return the user if it exists
        return {
            'is_new': False,
            'user': User.objects.get(username=username)
        }
    except User.DoesNotExist:
        # Fall to the default return value
        pass

    # Nothing to return since we don't have a user
    return {}
1298013
def login_user(request, hijacked):
    '''  '''
    hijacker = request.user
    hijack_history = [request.user._meta.pk.value_to_string(hijacker)]
    if request.session.get('hijack_history'):
        hijack_history = request.session['hijack_history'] + hijack_history

    check_hijack_authorization(request, hijacked)

    backend = get_used_backend(request)
    hijacked.backend = "%s.%s" % (backend.__module__, backend.__class__.__name__)

    with no_update_last_login():
        # Actually log user in
        login(request, hijacked)

    hijack_started.send(
            sender=None, request=request,
            hijacker=hijacker, hijacked=hijacked,
            # send IDs for backward compatibility
            hijacker_id=hijacker.pk, hijacked_id=hijacked.pk)
    request.session['hijack_history'] = hijack_history
    request.session['is_hijacked_user'] = True
    request.session['display_hijack_warning'] = True
    request.session.modified = True
    return redirect_to_next(request, default_url=hijack_settings.HIJACK_LOGIN_REDIRECT_URL)
881826
def getUserName(self):
        """"""
        if not self._server_side:
            return
        mech = self._authenticator.current_mech
        return mech.getUserName() if mech else None
178101
def get_cookie(self, key, secret=None):
        
        value = self.COOKIES.get(key)
        if secret and value:
            dec = cookie_decode(value, secret) # (key, value) tuple or None
            return dec[1] if dec and dec[0] == key else None
        return value or None