Package org.apache.geronimo.security

Examples of org.apache.geronimo.security.Callers


    public DefaultSubjectValve(Subject defaultSubject) {
        this.defaultSubject = defaultSubject;
    }

    public void invoke(Request request, Response response) throws IOException, ServletException {
        Callers oldCallers = null;
        boolean setSubject = false;
        if (defaultSubject != null) {
            oldCallers = ContextManager.getCallers();
            setSubject = oldCallers == null || oldCallers.getCurrentCaller() == null;
        }
        if (setSubject) {
            ContextManager.setCallers(defaultSubject, defaultSubject);
            try {
                getNext().invoke(request, response);
View Full Code Here


        setCurrentServletName(getName());
        try {
            if (runAsSubject == null) {
                super.handle(request, response);
            } else {
                Callers oldCallers = ContextManager.pushNextCaller(runAsSubject);
                try {
                    super.handle(request, response);
                } finally {
                    ContextManager.popCallers(oldCallers);
                }
View Full Code Here

        this.defaultSubject = defaultSubject;
    }

    public Object associate(UserIdentity userIdentity) {
        Subject subject = userIdentity == null? defaultSubject: userIdentity.getSubject();
        Callers callers = ContextManager.getCallers();
        ContextManager.setCallers(subject, subject);
        return callers;
    }
View Full Code Here

        threadContext.put(OLD_CALLERS,
                          ContextManager.getCallers());
   
        // set new security info
        String contextId = (String)threadContext.get(NEW_CONTEXT_ID);
        Callers callers = (Callers)threadContext.get(NEW_CALLERS);
       
        PolicyContext.setContextID(contextId);
        ContextManager.popCallers(callers); // works like setCallers()
    }
View Full Code Here

    public void unsetContext(Map<String, Object> threadContext) {
        LOG.debug("unsetContext");
       
        // restore old security info
        String contextId = (String)threadContext.get(OLD_CONTEXT_ID);
        Callers callers = (Callers)threadContext.get(OLD_CALLERS);
       
        PolicyContext.setContextID(contextId);
        ContextManager.popCallers(callers); // works like setCallers()
    }
View Full Code Here

     */
    public void handle(String target, HttpServletRequest request,
                       HttpServletResponse response, int dispatch) throws IOException,
            ServletException {
        String old_policy_id = PolicyContext.getContextID();
        Callers oldCallers = ContextManager.getCallers();
        PolicyContext.setContextID(policyContextID);
        HttpServletRequest oldRequest = PolicyContextHandlerHttpServletRequest.pushContextData(request);

        try {

View Full Code Here

        setCurrentServletName(getName());
        try {
            if (runAsSubject == null) {
                super.handle(request, response);
            } else {
                Callers oldCallers = ContextManager.pushNextCaller(runAsSubject);
                try {
                    super.handle(request, response);
                } finally {
                    ContextManager.popCallers(oldCallers);
                }
View Full Code Here

        this.defaultSubject = defaultSubject;
        this.runAsSource = runAsSource;
    }

    public Object associate(UserIdentity user) {
        Callers oldCallers = ContextManager.getCallers();
        if (user == null) {
            //exit
            ContextManager.setCallers(defaultSubject, defaultSubject);
        } else {
            //enter
View Full Code Here

     */
    public void handle(String target, Request baseRequest, HttpServletRequest request,
                       HttpServletResponse response) throws IOException,
            ServletException {
        String old_policy_id = PolicyContext.getContextID();
        Callers oldCallers = ContextManager.getCallers();
        HttpServletRequest oldRequest = PolicyContextHandlerHttpServletRequest.pushContextData(request);
        try {
            PolicyContext.setContextID(policyContextID);


View Full Code Here

                Wrapper wrapper = event.getWrapper();
                String runAsRole = wrapper.getRunAs();
                Subject runAsSubject = context.getSubjectForRole(runAsRole);
                List<Callers> callersStack = threadLocal.get();
                if (runAsSubject != null) {
                    Callers oldCallers = ContextManager.pushNextCaller(runAsSubject);
                    callersStack.add(oldCallers);
                } else {
                    callersStack.add(null);
                }
            }
        }

        else if (event.getType().equals(InstanceEvent.AFTER_SERVICE_EVENT)) {
            List<Callers> callersStack = threadLocal.get();
            Callers oldCallers = callersStack.remove(callersStack.size() - 1);
            if (oldCallers!=null) {
                ContextManager.popCallers(oldCallers);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.geronimo.security.Callers

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.