Package it.eng.spago.base

Examples of it.eng.spago.base.SessionContainer


  /* (non-Javadoc)
   * @see it.eng.spago.dispatching.service.ServiceIFace#service(it.eng.spago.base.SourceBean, it.eng.spago.base.SourceBean)
   */
  public void service(SourceBean request, SourceBean response) throws Exception {
    logger.debug("IN");
    SessionContainer permSession = this.getRequestContainer().getSessionContainer().getPermanentContainer();
    IEngUserProfile profile = (IEngUserProfile) permSession.getAttribute(IEngUserProfile.ENG_USER_PROFILE);

    if (profile == null) {
      logger.error("Profile not found");
      throw new Exception("User profile not found");
    }
View Full Code Here


    errorHandler  = getErrorHandler();
    if(message != null && message.equalsIgnoreCase("EXIT_FROM_MODULE")) {
      String returnState = (String) request.getAttribute("RETURN_STATE");
      response.setAttribute("PUBLISHER_NAME""ReturnBackPublisher");     
      RequestContainer requestContainer = this.getRequestContainer()
      SessionContainer session = requestContainer.getSessionContainer();
      session.setAttribute("RETURN_FROM_MODULE", "ListLookupParametersModule");
      session.setAttribute("RETURN_STATUS", returnState);
      if(returnState.equalsIgnoreCase("SELECT"))
        session.setAttribute("PAR_ID", request.getAttribute("PAR_ID"))
     
      return;
    }
    else if (message != null && message.trim().equalsIgnoreCase(AdmintoolsConstants.DETAIL_DEL)) {
      delDetailParameter(request);
View Full Code Here

  /* (non-Javadoc)
   * @see it.eng.spago.dispatching.service.ServiceIFace#service(it.eng.spago.base.SourceBean, it.eng.spago.base.SourceBean)
   */
  public void service(SourceBean request, SourceBean response) throws Exception {
    RequestContainer reqCont = getRequestContainer();
    SessionContainer sessCont = reqCont.getSessionContainer();
    SessionContainer permSess = sessCont.getPermanentContainer();
    IEngUserProfile profile = (IEngUserProfile)permSess.getAttribute(IEngUserProfile.ENG_USER_PROFILE);

    String idMenu = (String) request.getAttribute(DetailMenuModule.MENU_ID);
    Integer id = new Integer(idMenu);
    IMenuDAO dao=DAOFactory.getMenuDAO();
    dao.setUserProfile(profile);
View Full Code Here

     
      String resultStr = null;
     
      ObjNote objnote = null;
     
      SessionContainer sessCont = getSessionContainer();
      SessionContainer permCont = sessCont.getPermanentContainer();
      IEngUserProfile  profile = (IEngUserProfile)permCont.getAttribute(IEngUserProfile.ENG_USER_PROFILE);
     
      String owner = (String)((UserProfile)profile).getUserId();
      try {
        objnote = DAOFactory.getObjNoteDAO().getExecutionNotesByOwner(obj.getId(), execIdentifier, owner);
      } catch (Exception e) {
View Full Code Here

    locale = GeneralUtilities.getDefaultLocale();
   
    requestContainer = RequestContainer.getRequestContainer();
    if(requestContainer != null){
     
      SessionContainer permSess = getSessionContainer().getPermanentContainer();
      String lang = (String)permSess.getAttribute(SpagoBIConstants.AF_LANGUAGE);
      String country = (String)permSess.getAttribute(SpagoBIConstants.AF_COUNTRY);
     
      if(lang != null){
        if(country != null) {
          locale = new Locale(lang, country);
        } else {
View Full Code Here

    boolean activeSoo=false;
    if (activeStr != null && activeStr.equalsIgnoreCase("true")) {
      activeSoo=true;
    }
    RequestContainer reqCont = RequestContainer.getRequestContainer();
    SessionContainer sessCont = reqCont.getSessionContainer();
    SessionContainer permSess = sessCont.getPermanentContainer();

    HttpServletRequest servletRequest=getHttpRequest();
    HttpSession httpSession=servletRequest.getSession();

    // Set THEME
    if (theme_name!=null && theme_name.length()>0){
      permSess.setAttribute(SpagoBIConstants.THEME, theme_name);
    }



    // updates locale information on permanent container for Spago messages mechanism
    // search firstly if a default language is set on configuraiton file, else take browser from spago

    if(permSess.getAttribute(Constants.USER_LANGUAGE)== null || permSess.getAttribute(Constants.USER_COUNTRY) == null){
      logger.debug("getting locale...");
      Locale locale =GeneralUtilities.getStartingDefaultLocale();
      if(locale == null){
        locale = MessageBuilder.getBrowserLocaleFromSpago();
      }
      else{
        logger.debug("Locale "+locale.getLanguage()+" - "+locale.getCountry()+" taken as default from configuraiton file");
      }
      if (locale != null) {
        logger.debug("locale taken as default is "+locale.getLanguage()+" - "+locale.getCountry());
        permSess.setAttribute(Constants.USER_LANGUAGE, locale.getLanguage());
        permSess.setAttribute(Constants.USER_COUNTRY, locale.getCountry());
      }
    }
    else{
      logger.debug("locale already found in session")
    }


    // Set BACK URL if present
    String backUrl=(String)request.getAttribute(SpagoBIConstants.BACK_URL);

    if (backUrl!=null && !backUrl.equalsIgnoreCase("")){
      //permSess.setAttribute(SpagoBIConstants.BACK_URL, backUrl);
      httpSession.setAttribute(SpagoBIConstants.BACK_URL, backUrl);   
    }

    errorHandler = getErrorHandler();

    UserProfile previousProfile = (UserProfile) permSess.getAttribute(IEngUserProfile.ENG_USER_PROFILE);

    String userId=null;
    if (!activeSoo) {
      userId = (String)request.getAttribute("userID");
      logger.debug("userID="+userId);
      if (userId == null) {
        if (previousProfile != null) {
          profile = previousProfile;
          // user is authenticated, nothing to do
          logger.debug("User is authenticated");
          // fill response
          MenuUtilities.getMenuItems(request, response, profile);
          // set publisher name
          response.setAttribute(SpagoBIConstants.PUBLISHER_NAME, "userhome");
          return;
        } else {
          // user must authenticate
          logger.debug("User must authenticate");
          String url = servletRequest.getProtocol().substring(0,servletRequest.getProtocol().indexOf("/")) +
          "://"+servletRequest.getServerName()+":"+servletRequest.getLocalPort()+servletRequest.getContextPath();
          response.setAttribute("start_url", url);
          response.setAttribute(SpagoBIConstants.PUBLISHER_NAME, "login");
          logger.debug("OUT");
          return;
        }
        //logger.error("User identifier not found. Cannot build user profile object");
        //throw new SecurityException("User identifier not found.");
      }     
    } else {

      SsoServiceInterface userProxy = SsoServiceFactory.createProxyService();
      userId = userProxy.readUserIdentifier(servletRequest);
      logger.debug("OUT,userId:"+userId);
      // if we are in SSO and user has a previous profile keep it!
      if (previousProfile != null && previousProfile.getUserId().equals(userId)) {
        if (previousProfile != null) {
          profile = previousProfile;
          // user is authenticated, nothing to do
          logger.debug("User is authenticated");
          // fill response
          MenuUtilities.getMenuItems(request, response, profile);
          // set publisher name
          response.setAttribute(SpagoBIConstants.PUBLISHER_NAME, "userhome");
          return;
        }
      } 

    }
   
   
    ISecurityServiceSupplier supplier=SecurityServiceSupplierFactory.createISecurityServiceSupplier();
    // If SSO is not active, check username and password, i.e. performs the authentication;
    // instead, if SSO is active, the authentication mechanism is provided by the SSO itself, so SpagoBI does not make
    // any authentication, just creates the user profile object and puts it into Spago permanent container
    if (!activeSoo) {
      String pwd=(String)request.getAttribute("password");      
      try {
        Object ris=supplier.checkAuthentication(userId, pwd);
        if (ris==null){
          logger.error("pwd uncorrect");
          EMFUserError emfu = new EMFUserError(EMFErrorSeverity.ERROR, 501);
          errorHandler.addError(emfu);          
          return;
        }
      } catch (Exception e) {
        logger.error("Reading user information... ERROR");
        throw new SecurityException("Reading user information... ERROR",e);
      }
      //getting security type: if it's internal (SpagoBI) active pwd management and checks
      boolean isInternalSecurity = ("true".equalsIgnoreCase((String)request.getAttribute("isInternalSecurity")))?true:false;
      logger.debug("isInternalSecurity: " + isInternalSecurity);
      if (isInternalSecurity)  {      
        //gets the user bo
        ISbiUserDAO userDao = DAOFactory.getSbiUserDAO();
        SbiUser user = userDao.loadSbiUserByUserId(userId);

        //check user's role: if he's admin it doesn't apply checks on password
        String strAdminPatter =  SingletonConfig.getInstance().getConfigValue("SPAGOBI.SECURITY.ROLE-TYPE-PATTERNS.ADMIN-PATTERN");
        int sbiUserId=-1;
        if (user!=null)sbiUserId=user.getId();
        List lstRoles = userDao.loadSbiUserRolesById(sbiUserId);
        boolean isAdminUser = false;

        for (int i=0; i<lstRoles.size(); i++){
          SbiExtRoles tmpRole = (SbiExtRoles)lstRoles.get(i);
          Role role = DAOFactory.getRoleDAO().loadByID(tmpRole.getExtRoleId());
          if (role.getName().equals(strAdminPatter)){
            isAdminUser = true;
            logger.debug("User is administrator. Checks on the password are not applied !");
            break;
          }
        }

        if (!isAdminUser){
          //check validation of the password
          logger.debug("Validation password starting...");

          boolean goToChangePwd = checkPwd(user);
          if (goToChangePwd){
            response.setAttribute("user_id", user.getUserId());
            String url = servletRequest.getProtocol().substring(0,servletRequest.getProtocol().indexOf("/")) +
            "://"+servletRequest.getServerName()+":"+servletRequest.getLocalPort()+servletRequest.getContextPath();
            response.setAttribute("start_url", url);
            response.setAttribute(SpagoBIConstants.PUBLISHER_NAME, "ChangePwdPublisher");
            return;
          }

          logger.info("The pwd is active!");
          //update lastAccessDate on db with current date
          try{
            if (user!=null){
              user.setDtLastAccess(new Date());
              userDao.updateSbiUser(user, user.getId());
            }
          }catch(Exception e){
            logger.error("Error while update user's dtLastAccess: " + e);
          }
        }
      }
    }

    try {
      profile=UserUtilities.getUserProfile(userId);
      if (profile == null){                 
        logger.error("user not created");
        EMFUserError emfu = new EMFUserError(EMFErrorSeverity.ERROR, 501);
        errorHandler.addError(emfu);          
        return;
      }

      Boolean userHasChanged = Boolean.TRUE;
      // try to find if the user has changed: if so, the session parameters must be reset, see also homebis.jsp
      // check previous userId with current one: if they are equals, user has not changed
      if (previousProfile != null && previousProfile.getUserId().equals(((UserProfile)profile).getUserId())) {
        userHasChanged = Boolean.FALSE;
      }
      response.setAttribute("USER_HAS_CHANGED", userHasChanged);
      // put user profile into session
      permSess.setAttribute(IEngUserProfile.ENG_USER_PROFILE, profile);


    } catch (Exception e) {
      logger.error("Reading user information... ERROR");
      throw new SecurityException("Reading user information... ERROR",e);
View Full Code Here

    // if submessage is valorized it gives the value to message
    if (subMessageExec != null && !subMessageExec.equals(""))
      messageExec = subMessageExec;
    errorHandler = getErrorHandler();
    requestContainer = this.getRequestContainer();
    SessionContainer session = requestContainer.getSessionContainer();
    contextManager = new CoreContextManager(new SpagoBISessionContainer(session),
        new LightNavigatorContextRetrieverStrategy(request));

    permanentSession = session.getPermanentContainer();
    logger.debug("errorHanlder, requestContainer, session, permanentSession retrived ");

    try {
      if (messageExec == null || messageExec.equalsIgnoreCase(SpagoBIConstants.EXEC_PHASE_CREATE_PAGE)) {
        initNewExecutionHandler(request, response);
View Full Code Here

    String retCode = "";

    HttpServletResponse response = getHttpResponse();

    try {
      SessionContainer permSession = this.getRequestContainer().getSessionContainer().getPermanentContainer();
      IEngUserProfile profile = (IEngUserProfile) permSession.getAttribute(IEngUserProfile.ENG_USER_PROFILE);
      if (profile == null) {
        logger.error("User profile not found");
        throw new Exception("User profile not found");
      }
      String userId = ((UserProfile)profile).getUserId().toString();
View Full Code Here

   * @see it.eng.spago.dispatching.service.ServiceIFace#service(it.eng.spago.base.SourceBean, it.eng.spago.base.SourceBean)
   */
  public void service(SourceBean request, SourceBean response) throws Exception {
   
    RequestContainer reqCont = RequestContainer.getRequestContainer();
    SessionContainer sessCont = reqCont.getSessionContainer();
    SessionContainer permSess = sessCont.getPermanentContainer();
   
    //Start writing log in the DB
    Session aSession =null;
    try {
      aSession = HibernateUtil.currentSession();
      Connection jdbcConnection = aSession.connection();
      IEngUserProfile profile = (IEngUserProfile)permSess.getAttribute(IEngUserProfile.ENG_USER_PROFILE);
      AuditLogUtilities.updateAudit(jdbcConnection,  profile, "activity.Logout", null);
    } catch (HibernateException he) {
      throw new EMFUserError(EMFErrorSeverity.ERROR, 100);
    } finally {
      if (aSession!=null){
        if (aSession.isOpen()) aSession.close();
      }
    }
    //End writing log in the DB
   
    permSess.setAttribute(IEngUserProfile.ENG_USER_PROFILE, null);
   
  }
View Full Code Here

    JbpmContext jbpmContext = null;
    // Empty task list definition
    List taskList = new ArrayList();
    try{
      //Getting Containers
      SessionContainer session = getRequestContainer().getSessionContainer();
      SessionContainer permSession = session.getPermanentContainer();
      //ApplicationContainer application = ApplicationContainer.getInstance();
      IEngUserProfile userProfile = (IEngUserProfile)permSession.getAttribute(IEngUserProfile.ENG_USER_PROFILE);
      //Getting Jbpm context
      JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
      jbpmContext = jbpmConfiguration.createJbpmContext();
      //Getting user roles
      Collection roles = null;
View Full Code Here

TOP

Related Classes of it.eng.spago.base.SessionContainer

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.