Push the subjects associated with this security context onto the thread.
499071
@Override
    public void taskStarting() {
        final boolean trace = TraceComponent.isAnyTracingEnabled();

        prevInvocationSubject = subjectManager.getInvocationSubject();
        prevCallerSubject = subjectManager.getCallerSubject();

        if (trace && tc.isEntryEnabled())
            Tr.entry(this, tc, "taskStarting", "previous caller/invocation subjects", prevCallerSubject, prevInvocationSubject);

        subjectManager.setInvocationSubject(invocationSubject);
        subjectManager.setCallerSubject(callerSubject);

        if (trace && tc.isEntryEnabled())
            Tr.exit(this, tc, "taskStarting", new Object[] { "new caller/invocation subjects", callerSubject, invocationSubject });
    }
899842
private void applySecurity(final SecurityContext securityContext, boolean update) {

        // System.out.println("<< Process SecurityContext on column "+title+": "+securityContext+">>");

        // calculate accessible menu items
        filterNonPrivilegeOperations(securityContext, accessibleTopMenuItems, topMenuItems);
        filterNonPrivilegeOperations(securityContext,accessibleMenuItems, menuItems);

        // the top menu is build here
        if(!plain)
            buildTopMenu(headerMenu);

        // the row level menu is build when the celltable is filled
        // hence we need to refresh it

        toggleRowLevelTools(() -> true); // hide it
        Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
            @Override
            public void execute() {
                dataProvider.refresh();
                Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
                    @Override
                    public void execute() {
                        toggleRowLevelTools(() -> selectionModel.getSelectedObject() == null); // show when selected
                    }
                });
            }
        });

    }
336722
protected void updateSubjectWithSharedStateContents() {
        subject.getPrincipals().add((WSPrincipal) sharedState.get(Constants.WSPRINCIPAL_KEY));
        subject.getPublicCredentials().add(sharedState.get(Constants.WSCREDENTIAL_KEY));
        if (sharedState.get(Constants.WSSSOTOKEN_KEY) != null)
            subject.getPrivateCredentials().add(sharedState.get(Constants.WSSSOTOKEN_KEY));
    }
1208466
def group_push(name, app, weight, **kwargs):
    
    ctx = Context(**kwargs)
    ctx.execute_action('group:app:add', **{
        'storage': ctx.repo.create_secure_service('storage'),
        'name': name,
        'app': app,
        'weight': weight,
    })
1258922
private void doHandleAs(Subject subject, final HttpExchange pHttpExchange) {
        try {
            Subject.doAs(subject, new PrivilegedExceptionAction<Void>() {
            public Void run() throws IOException {
                doHandle(pHttpExchange);
                return null;
            }
            });
        } catch (PrivilegedActionException e) {
            throw new SecurityException("Security exception: " + e.getCause(),e.getCause());
        }
    }
934230
def _push(host, port, q, done, mps, stop, test_mode):
    """"""
    sock = None
    retry_line = None
    while not ( stop.is_set() or ( done.is_set() and retry_line == None and q.empty()) ):
        stime = time.time()

        if sock == None and not test_mode:
            sock = _mksocket(host, port, q, done, stop)
            if sock == None:
                break

        if retry_line:
            line = retry_line
            retry_line = None
        else:
            try:
                line = q.get(True, 1)  # blocking, with 1 second timeout
            except:
                if done.is_set():  # no items in queue, and parent finished
                    break
                else:  # no items in queue, but parent might send more
                    continue

        if not test_mode:
            try:
                sock.sendall(line.encode('utf-8'))
            except:
                sock = None  # notify that we need to make a new socket at start of loop
                retry_line = line  # can't really put back in q, so remember to retry this line
                continue

        etime = time.time() - stime  #time that actually elapsed

        #Expected value of wait_time is 1/MPS_LIMIT, ie. MPS_LIMIT per second.
        if mps > 0:
            wait_time = (2.0 * random.random()) / (mps)
            if wait_time > etime:  #if we should wait
                time.sleep(wait_time - etime)  #then wait

    if sock:
        sock.close()
1131484
public synchronized void push() {
        for (int i = 0; i < count; i++) {
            int ix = (start+i)%buffer.length;
            LogRecord record = buffer[ix];
            target.publish(record);
        }
        // Empty the buffer.
        start = 0;
        count = 0;
    }
568646
def push(self):
        ''''''
        message = self.build_message()
        return requests.post(self.hook, json=message)
632004
def _reap_payloads(self):
        """"""
        for thread in self._threads.copy():
            # CapturingThread.join will throw
            if thread.join(timeout=0):
                self._threads.remove(thread)
                self._logger.debug('reaped thread %s', thread)
802818
private void setJettyAuthentication(Subject subject) {
        // In unit test environments there may not be a current connection.  If any nulls are encountered
        // then, by definition, there is no container to update.
        HttpConnection connection = HttpConnection.getCurrentConnection();
        if (connection == null) {
            return;
        }
        Request jettyRequest = connection.getHttpChannel().getRequest();
        if (jettyRequest == null) {
            return;
        }

        // This cast down is safe; subject is always created with this type of principal
        PrincipalWithRoles principal = (PrincipalWithRoles) subject.getPrincipal();
        UserIdentity identity = principal.toUserIdentity();

        jettyRequest.setAuthentication(new UserAuthentication(SecurityContext.BASIC_AUTH, identity));
    }
147500
public static Context pushContext(Map<String, Object> current) {
        Context context = new Context(getContext(), current);
        LOCAL.set(context);
        return context;
    }
1031965
private void optimize(final Subject subject) {
        if (System.getSecurityManager() == null)
            subject.setReadOnly();
        else
            AccessController.doPrivileged(new PrivilegedAction<Void>() {
                @Override
                public Void run() {
                    subject.setReadOnly();
                    return null;
                }
            });
    }
322475
public void setTaskMaxThreads(Integer maxThreads) throws SecurityException {
	checkWriteAccess();
	boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_SETTING);
	if (!hasAccess) throw new SecurityException("no access to update task settings");
	Element mail = _getRootElement("remote-clients");
	mail.setAttribute("max-threads", Caster.toString(maxThreads, ""));
    }
150973
@SuppressWarnings("unchecked")
    void initThreadContext(WSContextService contextSvc, Map<String, String> execProps) {
        threadContext = contextSvc.captureThreadContext(execProps);
    }
1371573
public static void pushContext() {
        RpcInternalContext context = LOCAL.get();
        if (context != null) {
            Deque<RpcInternalContext> deque = DEQUE_LOCAL.get();
            if (deque == null) {
                deque = new ArrayDeque<RpcInternalContext>();
                DEQUE_LOCAL.set(deque);
            }
            deque.push(context);
            LOCAL.set(null);
        }
    }
1001400
private void setName(Thread thread, String name) {
        try {
            thread.setName(name);
        } catch (SecurityException se) {
            if (LOGGER.isWarnEnabled()) {
                LOGGER.warn("Failed to set the thread name.", se);
            }
        }
    }
1314059
def push(self, code, msg=None):
        """"""
        if msg is None:
            msg = str(code)
        else:
            msg = '%s %s' % (code, msg)

        if not msg.endswith(self.LINE_TERMINATOR):
            msg += self.LINE_TERMINATOR
        self._channel.write(msg)