Package com.adito.security

Examples of com.adito.security.SessionInfo


     *      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 DefaultPolicy(selectedRealmId);
    }
View Full Code Here


          saveErrors(request, mesgs);
          return new RedirectWithMessages(mapping.findForward("success"), request);
        }
        Map map = LogonControllerFactory.getInstance().getActiveSessions();
        synchronized (map) {
          SessionInfo info = (SessionInfo) map.get(ticket);
          if (info == null) {
            throw new Exception("No session with ticket " + ticket);
          } else {
            if(info.getType() == SessionInfo.UI || info.getType() == SessionInfo.DAV_CLIENT) {
              info.invalidate();
            }
            else if(info.getType() == SessionInfo.AGENT) {
                DefaultAgentManager.getInstance().unregisterAgent(info);
            }
          }
        }
      } catch(IllegalStateException ex) {
View Full Code Here

    public ActionForward commit(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
                    throws Exception {
        PromptForSessionPasswordForm pfspf = (PromptForSessionPasswordForm) form;
        AuthenticationScheme scheme = (AuthenticationScheme) getSessionInfo(request).getHttpSession().getAttribute(Constants.AUTH_SESSION);
        try {
            SessionInfo session = getSessionInfo(request);
            UserDatabase udb = UserDatabaseManager.getInstance().getUserDatabase(session.getUser().getRealm());
            String username = session.getUser().getPrincipalName();
            if (!udb.checkPassword(username, pfspf.getPassword())) {
                throw new Exception("Incorrect password.");
            }
            scheme.addCredentials(new PasswordCredentials(username, pfspf.getPassword().toCharArray()));
            request.setAttribute(Constants.REQ_ATTR_FORWARD_TO, ((PromptForSessionPasswordForm)form).getForwardTo());
View Full Code Here

      PolicyUtil.checkPermission(PolicyConstants.STATUS_TYPE_RESOURCE_TYPE, PolicyConstants.PERM_VIEW, request);     
      String ticket = request.getParameter("ticket");
      if(ticket == null) {
        throw new Exception("No ticket parameter supplied.");
      }
      SessionInfo info = LogonControllerFactory.getInstance().getSessionInfo(ticket);
      request.setAttribute(Constants.REQ_ATTR_INFO_RESOURCE, info);
      return sessionInformation(mapping, form, request, response);
    } catch (Exception e) {
      log.error("Failed to get session information. ", e);
      response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
View Full Code Here

   * @throws Exception
   */
  public ActionForward sessionInformation(ActionMapping mapping, ActionForm form, HttpServletRequest request,
                        HttpServletResponse response) throws Exception {
    SessionInformationForm informationForm = (SessionInformationForm) form;
    SessionInfo session = (SessionInfo) request.getAttribute(Constants.REQ_ATTR_INFO_RESOURCE);
    informationForm.initialise(session);
    return mapping.findForward("display");
  }
View Full Code Here

     * @param session
     * @return String
     */
    public static String getThemePath(HttpSession session) {
        try {
            SessionInfo info = LogonControllerFactory.getInstance().getSessionInfo(session);
            if (info == null) {
                return Property.getProperty(new ProfilePropertyKey(0, null, "ui.theme", UserDatabaseManager.getInstance()
                                .getDefaultUserDatabase().getRealm().getResourceId()));
            } else {
                return Property.getProperty(new ProfilePropertyKey(getCurrentPropertyProfileId(session), info.getUser().getPrincipalName(),
                                "ui.theme", info.getUser().getRealm().getResourceId()));
            }
        } catch (Exception e) {
        }
        return "/theme/default";
    }
View Full Code Here

     * @param session
     * @return boolean
     */
    public static boolean getToolTipsEnabled(HttpSession session) {
        try {
            SessionInfo info = LogonControllerFactory.getInstance().getSessionInfo(session);
            if (info == null) {
                return Property.getPropertyBoolean(new ProfilePropertyKey(0, null, "ui.toolTips", UserDatabaseManager.getInstance()
                                .getDefaultUserDatabase().getRealm().getResourceId()));
            } else {
                return Property.getPropertyBoolean(new ProfilePropertyKey(getCurrentPropertyProfileId(session), info.getUser().getPrincipalName(),
                                "ui.toolTips", info.getUser().getRealm().getResourceId()));
            }
        } catch (Exception e) {
        }
        return true;
    }
View Full Code Here

     */
    public static void checkNavigationContext(CoreAction action, ActionMapping mapping, ActionForm form,
                                              HttpServletRequest request, HttpServletResponse response) throws Exception {
        int navigationContext = action.getNavigationContext(mapping, form, request, response);
        if (!ContextHolder.getContext().isSetupMode()) {
            SessionInfo info = LogonControllerFactory.getInstance().getSessionInfo(request);
            if ((navigationContext & info.getNavigationContext()) == 0) {
                if ((navigationContext & SessionInfo.MANAGEMENT_CONSOLE_CONTEXT) != 0) {                 
                  if(!PolicyDatabaseFactory.getInstance().isAnyAccessRightAllowed(info.getUser(), true, true, false)) {
                        throw new NoPermissionException("You do not have permission to use the management console.");                   
                  }
                    info.setNavigationContext(SessionInfo.MANAGEMENT_CONSOLE_CONTEXT);
                    CoreUtil.resetMainNavigation(request.getSession());
                } else if ((navigationContext & SessionInfo.USER_CONSOLE_CONTEXT) != 0) {
                    info.setNavigationContext(SessionInfo.USER_CONSOLE_CONTEXT);
                    CoreUtil.resetMainNavigation(request.getSession());
                } else if ((navigationContext & SessionInfo.HELP_CONTEXT) != 0) {
                    // do nothing
                } else {
                    throw new NoPermissionException("Action does not define any valid navigation contexts that it should be available in.");
View Full Code Here

     *
     * @param request
     * @return boolean in user console
     */
    public static boolean isInUserConsole(HttpServletRequest request) {
        SessionInfo session = (SessionInfo) request.getSession().getAttribute(Constants.SESSION_INFO);
        return session != null && session.getNavigationContext() == SessionInfo.USER_CONSOLE_CONTEXT;
    }
View Full Code Here

     *
     * @param request
     * @return boolean in user console
     */
    public static boolean isInManagementConsole(HttpServletRequest request) {
        SessionInfo session = (SessionInfo) request.getSession().getAttribute(Constants.SESSION_INFO);
        return session != null && session.getNavigationContext() == SessionInfo.MANAGEMENT_CONSOLE_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.