This will (re)set only one user to the token
185007
function SetTokenAttributedUsers(
      $first_param,
      $second_param = "*-*"
  ) {
      $result = "";
      if ($second_param == "*-*") {
          $result = $first_param;
      } else {
          $this->SetToken($first_param);
          $result = $second_param;
      }
      $this->_token_data['attributed_users'] = $result;

      return $result;
  }
835640
def revoke_token(token_id, user):
    
    try:
        token = TokenBlacklist.query.filter_by(id=token_id, user_identity=user).one()
        token.revoked = True
        db.session.commit()
    except NoResultFound:
        raise TokenNotFound("Could not find the token {}".format(token_id))
904527
def set_token(self):
        
        super(ServicePrincipalCredentials, self).set_token()
        try:
            token = self._context.acquire_token_with_client_credentials(
                self.resource,
                self.id,
                self.secret
            )
            self.token = self._convert_token(token)
        except adal.AdalError as err:
            raise_with_traceback(AuthenticationError, "", err)
315264
def set_session_current_user(user)
    self.current_user = user
    # Try to reuse existing sessions.
    if session[:authpwn_suid]
      token = Tokens::SessionUid.with_code(session[:authpwn_suid]).first
      if token
        if token.user == user
          token.touch
          return user
        else
          token.destroy
        end
      end
    end
    if user
      session[:authpwn_suid] = Tokens::SessionUid.random_for(user,
          request.remote_ip, request.user_agent || 'N/A').suid
    else
      session.delete :authpwn_suid
    end
  end
1198591
def setUser(request):
    """"""

    if not settings.PIAPI_STANDALONE or settings.PIAPI_REALUSERS:
        raise Http404

    request.session['plugit-standalone-usermode'] = request.GET.get('mode')

    return HttpResponse('')
626075
def set_user(user, sender, instance, **kwargs):
        
        try:
            app_label, model_name = settings.AUTH_USER_MODEL.split('.')
            auth_user_model = apps.get_model(app_label, model_name)
        except ValueError:
            auth_user_model = apps.get_model('auth', 'user')
        if sender == LogAction and isinstance(user, auth_user_model) and instance.user is None:
            instance.user = user
        if hasattr(threadlocal, 'actionslog'):
            instance.remote_ip = threadlocal.actionslog['remote_ip']
237263
def reset
      self.access_token       = DEFAULT_ACCESS_TOKEN
      self.access_token       = DEFAULT_INVESTOR_ID
      self.adapter            = DEFAULT_ADAPTER
      self.endpoint           = DEFAULT_ENDPOINT
      self.format             = DEFAULT_FORMAT
      self.user_agent         = DEFAULT_USER_AGENT
    end
1104345
public final void setItsUser(final UserJetty pUser) {
    this.itsUser = pUser;
    if (this.itsId == null) {
      this.itsId = new IdUserRoleJetty();
    }
    this.itsId.setItsUser(this.itsUser);
  }
71892
def reset
      self.username           = DEFAULT_USERNAME
      self.password           = DEFAULT_PASSWORD
      self.user_agent         = DEFAULT_USER_AGENT
      self.auth_method        = DEFAULT_AUTH_METHOD
      self.proxy              = DEFAULT_PROXY
      self.consumer_key       = DEFAULT_CONSUMER_KEY
      self.consumer_secret    = DEFAULT_CONSUMER_SECRET
      self.oauth_token        = DEFAULT_OAUTH_TOKEN
      self.oauth_token_secret = DEFAULT_OAUTH_TOKEN_SECRET
      self
    end
1142197
def setsudo(self, user=None):
        
        if user is None:
            try:
                self.headers.pop('SUDO')
            except KeyError:
                pass
        else:
            self.headers['SUDO'] = user
415413
def become(cls, session_token):
        
        response = client.get('/users/me', params={'session_token': session_token})
        content = response.json()
        user = cls()
        user._update_data(content)
        user._handle_save_result(True)
        if 'smsCode' not in content:
            user._attributes.pop('smsCode', None)
        return user
800073
def session_token(self):
        """"""
        session_token = None
        if self.user_id is not None:
            session_token = token_getter(self.remote)
        if session_token:
            token = RemoteToken.get(
                self.user_id, self.remote.consumer_key,
                access_token=session_token[0]
            )
            return token
        return None
470453
@Transactional
	public void rotateUserAccessKey(final int id)
	{
		final UserEntity account = getById(id);

		if (account != null)
		{
			// Set the secondary token to the old primary token
			account.setAccessKeySecondary(account.getAccessKey());

			// Now regenerate the primary token
			account.setAccessKey(SimpleId.alphanumeric(UserManagerBearerToken.PREFIX, 100));

			update(account);
		}
		else
		{
			throw new IllegalArgumentException("No such user: " + id);
		}
	}
824851
def generate_user_token(self, user, salt=None):
        
        return self.token_serializer.dumps(str(user.id), salt=salt)
576078
final public static function setUserOtpToken (string $username, string $tokenValue)
	{
		// Check if user exists in database before setting OTP Token
		// Sets user OTP token to a session
		// i'm not storing it in a database to make it more secure cause its an OTP...

		if ($username) {
			$tokenTime 						= time(); 
			$_SESSION['otp_token'] 			= $tokenValue;
			$_SESSION['otp_token_time'] 	= $tokenTime;
			return $tokenValue;
		} else {
			return FALSE;
		}		
	}
1054959
def select_one_user(users):
        

        if len(users) == 1:
            select_i = 0
        else:
            table = PrettyTable(['Sequence', 'Name'])
            for i, user in enumerate(users, 1):
                table.add_row([i, user['nickname']])
            click.echo(table)

            select_i = click.prompt('Select one user', type=int, default=1)
            while select_i < 1 or select_i > len(users):
                select_i = click.prompt('Error Select! Select Again', type=int)

        user_id = users[select_i-1]['userId']
        user_name = users[select_i-1]['nickname']
        user = User(user_id, user_name)
        return user
677716
def revoke_session(self, sid='', token=''):
        
        if not sid:
            if token:
                sid = self.handler.sid(token)
            else:
                raise ValueError('Need one of "sid" or "token"')

        for typ in ['access_token', 'refresh_token', 'code']:
            try:
                self.revoke_token(self[sid][typ], typ)
            except KeyError:  # If no such token has been issued
                pass

        self.update(sid, revoked=True)