Package it.eng.spagobi.services.security.exceptions

Examples of it.eng.spagobi.services.security.exceptions.SecurityException


     
      SessionContainer sessionContainer = this.getRequestContainer().getSessionContainer();
      SessionContainer permanentContainer = sessionContainer.getPermanentContainer();
      IEngUserProfile profile = (IEngUserProfile) permanentContainer.getAttribute(IEngUserProfile.ENG_USER_PROFILE);
      if (profile == null) {
        throw new SecurityException("User profile not found in session");
      }
     
      String documentId = (String)request.getAttribute("documentId");
      if (documentId == null)
        throw new Exception("Document id missing!!");
View Full Code Here


       
        IObjTemplateDAO tempdao = DAOFactory.getObjTemplateDAO();
        ObjTemplate temp = tempdao.getBIObjectActiveTemplate(biobj.getId());
        if (temp==null){
           logger.warn("The template dor document [" + id + "] is NULL");
           throw new SecurityException("The template dor document [" + id + "] is NULL");
        }
        byte[] template = temp.getContent();
 
        BASE64Encoder bASE64Encoder = new BASE64Encoder();
        content.setContent(bASE64Encoder.encode(template));
View Full Code Here

       
        IObjTemplateDAO tempdao = DAOFactory.getObjTemplateDAO();
        ObjTemplate temp = tempdao.getBIObjectActiveTemplate(biobj.getId());
        if (temp==null){
           logger.warn("The template dor document [" + label + "] is NULL");
           throw new SecurityException("The template dor document [" + label + "] is NULL");
        }
        byte[] template = temp.getContent();
 
        BASE64Encoder bASE64Encoder = new BASE64Encoder();
        content.setContent(bASE64Encoder.encode(template));
View Full Code Here

      IEngUserProfile profile =null;
      try{
        profile = UserUtilities.getUserProfile(user);
        } catch (Exception e) {
          logger.error("An error occurred while creating the profile of user [" + user + "]");
          throw new SecurityException("An error occurred while creating the profile of user [" + user + "]", e);
        }       

        // Check if the user can execute the document
        boolean canSee = ObjectsAccessVerifier.canSee(biobj, profile);
        if (!canSee) {
          logger.error("Current user cannot execute the required document");
          throw new SecurityException("Current user cannot execute the required document");
        }
        Integer id = biobj.getId();
        // get the correct roles for execution
      List correctRoles = null;
      if (profile.isAbleToExecuteAction(SpagoBIConstants.DOCUMENT_MANAGEMENT_DEV)
          || profile.isAbleToExecuteAction(SpagoBIConstants.DOCUMENT_MANAGEMENT_USER)
          || profile.isAbleToExecuteAction(SpagoBIConstants.DOCUMENT_MANAGEMENT_ADMIN))
        correctRoles = DAOFactory.getBIObjectDAO().getCorrectRolesForExecution(id, profile);
      else
        correctRoles = DAOFactory.getBIObjectDAO().getCorrectRolesForExecution(id);
      logger.debug("correct roles for execution retrived " + correctRoles);
      if (correctRoles == null || correctRoles.size() == 0) {
        logger.error("Object cannot be executed by no role of the user");
        throw new SecurityException("Object cannot be executed by no role of the user");
      }
       
        if (parameters == null) {
          logger.debug("Input parameters map is null. It will be considered as an empty map");
          parameters = new HashMap();
        }
       
        boolean parametersAreCorrect = false;
       
        String roleName = (String) parameters.get("SBI_EXECUTION_ROLE");
        if (roleName != null) {
          // if a role is specified, check if it is a valid role for execution
          logger.debug("Execution role specified: " + roleName);
          if (!correctRoles.contains(roleName)) {
            if (correctRoles == null || correctRoles.size() == 0) {
              logger.error("Role [] is not a valid role for the execution of document with id = [" + biobj.getId()
                  + "], label = [" + biobj.getLabel() + "]");
              throw new SecurityException("Role [] is not a valid role for the execution of document with id = [" + biobj.getId()
                  + "], label = [" + biobj.getLabel() + "]");
            }
          }
          // check if parameter values are correct for the role
          parametersAreCorrect = checkParametersErrors(profile, biobj.getId(), roleName, parameters);
        } else {
          // if a role is not specified, iterate on valid roles
          logger.debug("Execution role not specified: iterating on all available roles...");
          Iterator it = correctRoles.iterator();
          while (it.hasNext()) {
            roleName = it.next().toString();
            // check if parameter values are correct for the role
            parametersAreCorrect = checkParametersErrors(profile, biobj.getId(), roleName, parameters);
            if (parametersAreCorrect) {
              break;
            } else {
              logger.debug("Role " + roleName + " is NOT compatible with input parameters");
            }
          }
         
        }
       
        if (!parametersAreCorrect) {
           logger.error("Document cannot be executed by the user with the input parameters.");
           throw new SecurityException("Document cannot be executed by the user with the input parameters.");
        } else {
          logger.debug("Role " + roleName + " is compatible with input parameters");
        }
    } finally {
        logger.debug("OUT");
View Full Code Here

    protected void validateTicket(String ticket, String userId)
      throws SecurityException {
    logger.debug("IN");
    if (ticket == null) {
      logger.warn("Ticket is NULL");
      throw new SecurityException("Ticket is NULL");
    }
    if (userId == null) {
      logger.warn("UserID is NULL");
      throw new SecurityException("Ticket is NULL");
    }
    if (ticket.equals(pass)) {
      logger.debug("JUMP che ticket validation");
    } else {
      SsoServiceInterface proxyService = SsoServiceFactory.createProxyService();
View Full Code Here

      SessionContainer sessCont = reqCont.getSessionContainer();
      SessionContainer permSess = sessCont.getPermanentContainer();
      profile = (IEngUserProfile) permSess.getAttribute(IEngUserProfile.ENG_USER_PROFILE);
      if (profile == null) {
        logger.error("User profile not found");
        throw new SecurityException("User profile not found");
      }

      String documentId = request.getParameter("documentId");
      logger.debug("got parameter documentId=" + documentId);
  
View Full Code Here

      String tmpUserId = pv.getUser();
      logger.debug("CAS User:" + tmpUserId);
      if userId==null || !userId.equals(tmpUserId)) {
          logger.warn("Proxy and application users are not the same [" + userId + "-"
            + tmpUserId + "]");
          throw new SecurityException("Proxy and application users are not the same [" + userId + "-"
              + tmpUserId + "]");
      }
     
     
      } else {
    logger.error("Token NOT VALID");
    throw new SecurityException("Token NOT VALID");
      }
  } catch (Throwable e) {
      logger.error("An exception occured while validating the cas token");
      throw new SecurityException("An exception occured while validating the cas token", e);
  } finally {
      logger.debug("OUT");
  }

    }
View Full Code Here

    principal = a.getPrincipal();
    logger.debug("Ticket is VALID, username=" + principal.getName());
     
  } catch (TicketValidationException e) {
    logger.error("An exception occured while validating the cas token");
    throw new SecurityException("An exception occured while validating the cas token", e);
  } catch (Throwable e) {
      logger.error("An exception occured while validating the cas token");
      throw new SecurityException("An exception occured while validating the cas token", e);
  } finally {
      logger.debug("OUT");
  }

    }
View Full Code Here

        service = locator.getDataSetService();   
      }
      return service;
  } catch (ServiceException e) {
      logger.error("Impossible to locate [" + SERVICE_NAME + "] at [" + serviceUrl + "]");
      throw new SecurityException("Impossible to locate [" + SERVICE_NAME + "] at [" + serviceUrl + "]", e);
  }
    }
View Full Code Here

        } else {
          service = locator.getSecurityService();
        }
    } catch (Throwable e) {
      logger.error("Impossible to locate [" + SERVICE_NAME + "] at [" + serviceUrl + "]");
        throw new SecurityException("Impossible to locate [" + SERVICE_NAME + "] at [" + serviceUrl + "]", e);
    }
   
    return service;
    }
View Full Code Here

TOP

Related Classes of it.eng.spagobi.services.security.exceptions.SecurityException

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.