Package com.adito.security

Examples of com.adito.security.SessionInfo


            // Try to initalise the highest priority scheme,
            if (request.getSession().getAttribute(Constants.SESSION_LOCKED) != null) {
                // If session locked then only display password

                SessionInfo info = LogonControllerFactory.getInstance().getSessionInfo(request);
                Calendar now = new GregorianCalendar();
                authScheme = new DefaultAuthenticationScheme(info.getRealmId(), Integer.MAX_VALUE, "Fake sheme", "Fake scheme",
                                now, now, true, 0);
                authScheme.addModule(PasswordAuthenticationModule.MODULE_NAME);
            } else {
                authScheme = logonStateMachine.getHighestPriorityScheme();
            }
View Full Code Here


     *      javax.servlet.http.HttpServletRequest,
     *      javax.servlet.http.HttpServletResponse)
     */
    public Resource createResource(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
                    throws Exception {
        SessionInfo sessionInfo = getSessionInfo(request);
        int selectedRealmId = sessionInfo.getRealmId();
        return new DefaultAccessRights(selectedRealmId, "");
    }
View Full Code Here

        }
        Resource resource = resourceType.getResourceById(Integer.parseInt(id));
        if(resource == null) {
            throw new Exception("No resource with ID " + id);
        }
        SessionInfo session = getSessionInfo(request);
        Policy policy = null;
        try {
          policy = LaunchSessionManager.getLaunchRequestPolicy(request, session, resource);
        } catch (Exception expt) {
          ActionMessages errs = new ActionMessages();
View Full Code Here

    protected ActionForward onExecute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
       
        /* 'Home' is available when in some kind of work flow such as a wizard
         * resource edit or file download. We need to clean up a bit
         */
        SessionInfo info = this.getSessionInfo(request);
        CoreUtil.clearFlow(request);
        CoreUtil.removePageInterceptListener(request.getSession(), FileDownloadPageInterceptListener.INTERCEPT_ID);
       
        // Forward on to the appropriate place
       
        switch(info.getNavigationContext()) {
        case SessionInfo.MANAGEMENT_CONSOLE_CONTEXT:
            return new RedirectWithMessages(mapping.findForward("managementConsole"), request);
        }
        return new RedirectWithMessages(mapping.findForward("userConsole"), request);
    }
View Full Code Here

     *      boolean)
     */
    public void initialise(HttpServletRequest request, Policy resource, boolean editing, MultiSelectSelectionModel policyModel,
                           PropertyList selectedPolicies, User owner, boolean assignOnly) throws Exception {
        super.initialise(request, resource, editing, policyModel, selectedPolicies, owner, assignOnly);
        SessionInfo sessionInfo = LogonControllerFactory.getInstance().getSessionInfo(request);
        Policy pol = (Policy) resource;
        selectedAccounts = new PropertyList();
        selectedRoles = new PropertyList();
        List principals = PolicyDatabaseFactory.getInstance().getPrincipalsGrantedPolicy((Policy) resource, user.getRealm());
        for (Iterator i = principals.iterator(); i.hasNext();) {
View Full Code Here

                        ce.getBundleActionMessage().setArg3(item.getLabel());
                        errs.add(Globals.ERROR_KEY, ce.getBundleActionMessage());
                    }
                }

                SessionInfo session = LogonControllerFactory.getInstance().getSessionInfo(request);
                UserDatabase udb = UserDatabaseManager.getInstance().getUserDatabase(session.getRealm());
                for (String account : selectedAccounts) {
                    try {
                        udb.getAccount(account);
                    } catch (Exception e) {
                        errs.add(Globals.ERROR_KEY, new ActionMessage("editPolicy.error.invalidUser", account));
                    }
                }
                for (String role : selectedRoles) {
                    try {
                        if (udb.getRole(role) == null) {
                            throw new Exception();
                        }
                    } catch (Exception e) {
                        errs.add(Globals.ERROR_KEY, new ActionMessage("editPolicy.error.invalidRole", role));
                    }
                }
            } catch (Exception e) {
                errs.add(Globals.ERROR_KEY, new ActionMessage("editPolicy.failedToValidate", e.getMessage()));
            }

            SessionInfo info = LogonControllerFactory.getInstance().getSessionInfo(request);
            boolean found = false;
            try {
                List wasAttached = PolicyDatabaseFactory.getInstance().getPrincipalsGrantedPolicy((Policy) this.getResource(),
                    info.getUser().getRealm()); // objects
                List nowAttached = this.getSelectedAccountsList();
                // only do this if the super user has been removed.
                if (wasAttached.contains(getUser()) && !nowAttached.contains(getUser().getPrincipalName())) {
                    List authSchemes = ResourceUtil.getGrantedResource(info, PolicyConstants.AUTHENTICATION_SCHEMES_RESOURCE_TYPE);
                    for (Iterator iter = authSchemes.iterator(); iter.hasNext();) {
                        AuthenticationScheme element = (DefaultAuthenticationScheme) iter.next();
                        if (!element.isSystemScheme() && element.getEnabled()) {
                            List attachedPolicies = PolicyDatabaseFactory.getInstance().getPoliciesAttachedToResource(element,
                                info.getUser().getRealm());
                            for (Iterator iterator = attachedPolicies.iterator(); iterator.hasNext();) {
                                Policy policy = (Policy) iterator.next();
                                if (!this.getResource().equals(policy)
                                                && PolicyDatabaseFactory.getInstance().isPolicyGrantedToUser(policy, getUser())) {
                                    found = true;
View Full Code Here

            log.error("Failed to initialise resources form.", t);
        }
    }
   
    public void checkSelectedView(HttpServletRequest request, HttpServletResponse response) {
        SessionInfo sessionInfo = (SessionInfo)request.getSession().getAttribute(Constants.SESSION_INFO);
        int realmID = sessionInfo.getRealm().getRealmID();
        int navigationContext = sessionInfo.getNavigationContext();
        String defaultView =  navigationContext ==
            SessionInfo.MANAGEMENT_CONSOLE_CONTEXT  
                    ? Property.getProperty(new SystemConfigKey("ui.defaultManagementConsoleViewType"))
                    : Property.getProperty(new ProfilePropertyKey("ui.defaultUserConsoleViewType", sessionInfo));
        if(navigationContext == SessionInfo.USER_CONSOLE_CONTEXT) {
            selectedView = CoreUtil.getCookieValue("ui_view_" + getModel().getId() + "_" + navigationContext, request, defaultView);
           
            if (selectedView == null){
                selectedView = Property.getProperty(new ProfilePropertyKey(CoreUtil.getCurrentPropertyProfileId(request.getSession()),
                                sessionInfo.getUser().getPrincipalName(),
                                "ui.defaultUserConsoleViewType", realmID));
               
                CoreUtil.storeUIState("ui_view_" + getModel().getId() + "_" + navigationContext, defaultView, request, response);
            }
View Full Code Here

      if (type == 3) {
        if (!tryCurrentUser) {
          type++;
        } else {

          SessionInfo inf = getStore().getRepository().getSession();

          char[] pw = LogonControllerFactory.getInstance()
                  .getPasswordFromCredentials((AuthenticationScheme) inf.getHttpSession()
                          .getAttribute(Constants.AUTH_SESSION));

          if (pw == null) {
            if (log.isDebugEnabled())
              log.debug("No password available from current session");
            type++;
          } else {
            credentials = new PasswordCredentials(inf.getUser().getPrincipalName(), pw);

            if (log.isDebugEnabled()) {
              log.debug("Trying current session credentials for " + "/" + getMountString() + path);
            }
          }
View Full Code Here

            request.setAttribute(Constants.REQ_ATTR_PROPERTY_DEFINITION, def);
            return mapping.findForward("property");
        }
        else if(source.equalsIgnoreCase("help")) {
            // load the documentation context menu
            SessionInfo info = LogonControllerFactory.getInstance().getSessionInfo(request);
            helpForm.setMenu(NavigationManager.getMenuTree(CoreMenuTree.MENU_ITEM_MENU_TREE).rebuildMenus(SessionInfo.HELP_CONTEXT,
                info,
                request,
                Util.getOriginalRequest(request)));
            return mapping.findForward("help");
View Full Code Here

        boolean policyGrantedToUser = policyDatabase.isPolicyGrantedToUser(launchSession.getPolicy(), launchSession.getSession().getUser());
        return resourceAttachedToPolicy && policyGrantedToUser;
    }
   
    private boolean isSuperUser(LaunchSession launchSession) {
        SessionInfo sessionInfo = launchSession.getSession();
        return LogonControllerFactory.getInstance().isAdministrator(sessionInfo.getUser());
    }
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.