Package com.adito.security

Examples of com.adito.security.SessionInfo


     */
    public ActionForward commit(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
                    throws Exception {
        PolicyUtil.checkPermission(PolicyConstants.ACCOUNTS_AND_GROUPS_RESOURCE_TYPE, PolicyConstants.PERM_CREATE_EDIT_AND_ASSIGN, request);
        RoleForm roleForm = (RoleForm) form;
        SessionInfo sessionInfo = getSessionInfo(request);
       
        if (roleForm.getEditing()) {
            String[] usersNotRemoved = updateRole(roleForm, sessionInfo);
            if (usersNotRemoved.length != 0) {
                saveError(request, "availableRoles.error.groupsRequired", Utils.commaList(usersNotRemoved));
View Full Code Here


   */
  public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
          throws Exception {

    try {
      SessionInfo session = LogonControllerFactory.getInstance().getSessionInfo(request);
      if(session != null) {
          VFSRepository.removeRepository(session);
               
        if(DefaultAgentManager.getInstance().hasActiveAgent(session))
          DefaultAgentManager.getInstance().unregisterAgent(session);
View Full Code Here

        Resource resource = ResourceStack.peekEditingStack(request.getSession());
        if (resource == null){
            // we must have lost the session, go back to home
            return mapping.findForward("home");
        }
        SessionInfo session = this.getSessionInfo(request);
        try {
            checkValid(resource, new Permission[] { PolicyConstants.PERM_PERSONAL_CREATE_EDIT_AND_DELETE }, mapping, (AbstractResourceForm) form, request);
        } catch (NoPermissionException e) {
            checkValid(resource, new Permission[] { getEditResourcePermission(), getCreateResourcePermission(), getAssignPermission() }, mapping, (AbstractResourceForm) form, request);
        }
        User ownerUser = null;
        if (resource instanceof OwnedResource) {
            String owner = ((OwnedResource) resource).getOwnerUsername();
            if (owner != null && !owner.equals("")) {
                ownerUser = UserDatabaseManager.getInstance().getUserDatabase(session.getUser().getRealm()).getAccount(owner);
            }
        }
        PropertyList selectedPolicies = new PropertyList();
        MultiSelectPoliciesSelectionModel policyModel = initSelectModel(selectedPolicies, ((AbstractResourceForm) form).isShowPersonalPolicies(), resource, session);
        String referer = CoreUtil.getReferer(request);
View Full Code Here

    public ActionForward toogleShowPersonalPolicies(ActionMapping mapping, ActionForm form, HttpServletRequest request,
                                                    HttpServletResponse response) throws Exception {
        AbstractResourceForm policyForm = (AbstractResourceForm) form;

        Resource resource = ResourceStack.peekEditingStack(request.getSession());
        SessionInfo session = this.getSessionInfo(request);

        PropertyList selectedPolicies = new PropertyList();
        String requestSelectedPolicies = request.getParameter("selectedPolicies");
        if (!Util.isNullOrTrimmedBlank(requestSelectedPolicies)) {
            selectedPolicies.setAsTextFieldText(requestSelectedPolicies);
View Full Code Here

    public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
                    throws Exception {

        ActionMessages msgs = new ActionMessages();

        SessionInfo sessionInfo = LogonControllerFactory.getInstance().getSessionInfo(request);
       
        if (sessionInfo == null && request.getSession().getAttribute(Constants.SESSION_LOCKED) == null
                        && LogonControllerFactory.getInstance().hasClientLoggedOn(request, response) == LogonController.LOGGED_ON) {
            if (log.isDebugEnabled())
                log.debug(request.getRemoteHost() + " is already authenticated");

            return mapping.findForward("success");
        }
       
        /*
         * Get the authentication session and module to use to validate this
         * authentication attempt
         */
        AuthenticationScheme scheme = (AuthenticationScheme) request.getSession().getAttribute(Constants.AUTH_SESSION);
        LogonStateAndCache logonStateMachine = (LogonStateAndCache) request.getSession().getAttribute(
                        LogonStateAndCache.LOGON_STATE_MACHINE);

        // there are different users so we need to logon again, clearing the authentication scheme and logon machine.
        if (sessionInfo != null && logonStateMachine != null && !sessionInfo.getUser().equals(logonStateMachine.getUser())){
            request.getSession().removeAttribute(Constants.AUTH_SESSION);
            request.getSession().removeAttribute(LogonStateAndCache.LOGON_STATE_MACHINE);
            LogonControllerFactory.getInstance().logoffSession(request, response);
            msgs.add(Globals.ERROR_KEY, new ActionMessage("login.logonNotAllowed", "Session no longer valid, logon again."));
            saveErrors(request, msgs);
View Full Code Here

        T resource = getSelectedResource(form);
        Permission[] permissions = new Permission[] { getRemovePermission() };
        checkValid(mapping, resourcesForm, request, resource, permissions);

        doRemove(mapping, form, request, response);
        SessionInfo sessionInfo = getSessionInfo(request);
        PolicyDatabaseFactory.getInstance().detachResourceFromPolicyList(resource, sessionInfo);
        return getRedirectWithMessages(mapping, request);
    }
View Full Code Here

        }
        if(ContextHolder.getContext().isSetupMode()) {
            // No need to check session
        }
        else {
            SessionInfo sessionInfo =
                LogonControllerFactory.getInstance().getSessionInfo(request);
            if(sessionInfo != task.getSession()) {
                log.warn("Not task owner.");
                response.sendError(HttpServletResponse.SC_BAD_REQUEST);
                return null;
View Full Code Here

     * @param menuItem root menu item
     * @param request request
     * @return available root menus
     */
    public List rebuildMenus(MenuItem menuItem, HttpServletRequest request) {
        SessionInfo info = LogonControllerFactory.getInstance().getSessionInfo(request);
            return rebuildMenus(menuItem, info == null ?0 :
                info.getNavigationContext(), info, request,
                                CoreUtil.getReferer(request));
    }
View Full Code Here

    /* (non-Javadoc)
     * @see com.adito.security.actions.AuthenticatedAction#onExecute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
     */
    protected ActionForward onExecute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
                    HttpServletResponse response) throws Exception {
        SessionInfo info = this.getSessionInfo(request);
        if(!PolicyDatabaseFactory.getInstance().isAnyAccessRightAllowed(info.getUser(), true, true, false)) {
            throw new Exception("You do not have permission to use the management console.");
        }
        info.setNavigationContext(SessionInfo.MANAGEMENT_CONSOLE_CONTEXT);
        CoreUtil.resetMainNavigation(request.getSession());
        MenuTree menuTree = NavigationManager.getMenuTree(CoreMenuTree.MENU_ITEM_MENU_TREE);
        ActionForward fwd = menuTree.getFirstAvailableActionForward(menuTree.rebuildMenus(request));
        if (fwd == null) {
            // Not capabilities left on management console so switching to user console
            info.setNavigationContext(SessionInfo.USER_CONSOLE_CONTEXT);
            return mapping.findForward("home");
        }
        return fwd;

    }
View Full Code Here

    /* (non-Javadoc)
     * @see com.adito.security.actions.AuthenticatedAction#onExecute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
     */
    protected ActionForward onExecute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
                    HttpServletResponse response) throws Exception {
        SessionInfo info = this.getSessionInfo(request);
        info.setNavigationContext(SessionInfo.USER_CONSOLE_CONTEXT);
        CoreUtil.resetMainNavigation(request.getSession());
        MenuTree menuTree = NavigationManager.getMenuTree(CoreMenuTree.MENU_ITEM_MENU_TREE);
        ActionForward fwd = menuTree.getFirstAvailableActionForward(menuTree.rebuildMenus(request));
        if (fwd == null) {
            throw new Exception("Use does not have any permission for using the current navigation context.");
View Full Code Here

TOP

Related Classes of com.adito.security.SessionInfo

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.