Package it.eng.spagobi.services.security.bo

Examples of it.eng.spagobi.services.security.bo.SpagoBIUserProfile


        logger.debug("Logged in with SHA pass");
      }else if(!password.equals(encrPass)){
        logger.error("UserName/pws not found into database");
        return null;
      }
      SpagoBIUserProfile obj=new SpagoBIUserProfile();
      obj.setUniqueIdentifier(userId);
      obj.setUserId(userId);
      obj.setUserName(userId);
     
      logger.debug("OUT");
      return obj;
    } catch (EMFUserError e) {
      logger.error(e.getMessage(), e);
View Full Code Here


    return false;
  }

  public SpagoBIUserProfile createUserProfile(String userId) {
    logger.debug("IN - userId: " + userId);
    SpagoBIUserProfile profile = null;
    try {
      SbiUser user = DAOFactory.getSbiUserDAO().loadSbiUserByUserId(userId);

      if (user == null) {
        logger.error("UserName [" + userId + "] not found!!");
          return null;
      }
 
      profile = new SpagoBIUserProfile();
      profile.setUniqueIdentifier(userId);
      profile.setUserId(userId);
      profile.setUserName(user.getFullName());
 
      // get user name
      String userName = userId;
      // get roles of the user
     
      ArrayList<SbiExtRoles> rolesSB = DAOFactory.getSbiUserDAO().loadSbiUserRolesById(user.getId());
      List roles = new ArrayList();
      Iterator iterRolesSB = rolesSB.iterator();
     
      IRoleDAO roleDAO = DAOFactory.getRoleDAO();
      while (iterRolesSB.hasNext()) {
        SbiExtRoles roleSB = (SbiExtRoles) iterRolesSB.next();

          roles.add(roleSB.getName());
      }
      HashMap attributes = new HashMap();
      ArrayList<SbiUserAttributes> attribs = DAOFactory.getSbiUserDAO().loadSbiUserAttributesById(user.getId());
      if(attribs != null){
        Iterator iterAttrs = attribs.iterator();
        while(iterAttrs.hasNext()){
            // Attribute to lookup
          SbiUserAttributes attribute = (SbiUserAttributes) iterAttrs.next();
         
          String attributeName = attribute.getSbiAttribute().getAttributeName();

            String attributeValue = attribute.getAttributeValue();
            if (attributeValue != null) {
              logger.debug("Add attribute. " + attributeName + "=" + attributeName + " to the user"
                  + userName);
            attributes.put(attributeName, attributeValue);
            }
        }
      }
 
      logger.debug("Attributes load into SpagoBI profile: " + attributes);
 
      // end load profile attributes
 
      String[] roleStr = new String[roles.size()];
      for (int i = 0; i < roles.size(); i++) {
          roleStr[i] = (String) roles.get(i);
      }
 
      profile.setRoles(roleStr);
      profile.setAttributes(attributes);
    } catch (EMFUserError e) {
      logger.error(e.getMessage(), e);
      return null;
    }
    logger.debug("OUT");
View Full Code Here

  if (userPwdsSB == null || userPwdsSB.size() == 0) {
      logger.error("UserName [" + userId + "] not found!!");
      return null;
  }
 
  SpagoBIUserProfile profile = new SpagoBIUserProfile();
  profile.setUniqueIdentifier(userId);
  profile.setUserId(userId);

  // get user name
  String userName = userId;
  // get roles of the user
  List rolesSB = configSingleton.getFilteredSourceBeanAttributeAsList(
    "AUTHORIZATIONS.RELATIONS.BEHAVIOURS.BEHAVIOUR", "userID", userName);
  List roles = new ArrayList();
  Iterator iterRolesSB = rolesSB.iterator();
  while (iterRolesSB.hasNext()) {
      SourceBean roleSB = (SourceBean) iterRolesSB.next();
      String rolename = (String) roleSB.getAttribute("roleName");
      roles.add(rolename);
  }

  // start load profile attributes
  HashMap userAttributes = new HashMap();
  List userSB = configSingleton.getFilteredSourceBeanAttributeAsList("AUTHORIZATIONS.ENTITIES.USERS.USER",
    "userID", userName);
  if (userSB.size() == 0) {
      logger.warn("User " + userName + " not found on configuration!!!");
  } else if (userSB.size() > 1)
      logger.warn("There are more user with userID=" + userName);
  else {
      SourceBean userTmp = (SourceBean) userSB.get(0);
      XmlSecurityInfoProviderImpl xmlSecInfo = new XmlSecurityInfoProviderImpl();
      List attributesList = xmlSecInfo.getAllProfileAttributesNames();
      if (attributesList != null) {
    Iterator iterAttributesList = attributesList.iterator();
    while (iterAttributesList.hasNext()) {
        // Attribute to lookup
        String attributeName = (String) iterAttributesList.next();
        String attributeValue = (String) userTmp.getAttribute(attributeName);
        if (attributeValue != null) {
      logger.debug("Add attribute. " + attributeName + "=" + attributeName + " to the user"
        + userName);
      userAttributes.put(attributeName, attributeValue);
        }
    }
      }
  }

  logger.debug("Attributes load into SpagoBI profile: " + userAttributes);

  // end load profile attributes

  String[] roleStr = new String[roles.size()];
  for (int i = 0; i < roles.size(); i++) {
      roleStr[i] = (String) roles.get(i);
  }

  profile.setRoles(roleStr);
  profile.setAttributes(userAttributes);
  //profile.setFunctions(readFunctionality(profile.getRoles()));

  logger.debug("OUT");
  return profile;
    }
View Full Code Here

    logger.error("UserName/pws not found into xml file");
    return null;
      }

  }
  SpagoBIUserProfile obj=new SpagoBIUserProfile();
  obj.setUniqueIdentifier(userId);
  obj.setUserId(userId);
  obj.setUserName(userId);

  logger.debug("OUT");
  return obj;
    }
View Full Code Here

public SpagoBIUserProfile getUserProfile(String token,String userId) {
        logger.debug("IN");
        Monitor monitor =MonitorFactory.start("spagobi.service.security.getUserProfile");
  try {
      validateTicket(token, userId);
      SpagoBIUserProfile user=supplier.createUserProfile(userId);
      user.setFunctions(UserUtilities.readFunctionality(user.getRoles()));
      return user;
  } catch (SecurityException e) {
      logger.error("SecurityException", e);
      return null;
  } finally {
View Full Code Here

    public boolean isAuthorized(String token,String userId, String idFolder, String state) {
        logger.debug("IN");
        Monitor monitor =MonitorFactory.start("spagobi.service.security.isAuthorized");
  try {
          validateTicket(token, userId);
    SpagoBIUserProfile profile= supplier.createUserProfile(userId);
    profile.setFunctions(UserUtilities.readFunctionality(profile.getRoles()));
    UserProfile userProfile=new UserProfile(profile);     
    return ObjectsAccessVerifier.canExec(new Integer(idFolder), userProfile);
  } catch (SecurityException e) {
      logger.error("SecurityException", e);
      return false;
View Full Code Here

 
  private void authenticate(String userId, String password) throws WSSecurityException {
    logger.debug("IN: userId = " + userId);
    try {
      ISecurityServiceSupplier supplier = SecurityServiceSupplierFactory.createISecurityServiceSupplier();
      SpagoBIUserProfile profile = supplier.checkAuthentication(userId, password);
      if (profile == null) {
        logger.error("Authentication failed for user " + userId);
        throw new WSSecurityException(WSSecurityException.FAILED_AUTHENTICATION);
      }
    } catch (WSSecurityException e) {
View Full Code Here

     
      logger.debug("IN");
     
      userProfile = null;
    try {
            SpagoBIUserProfile user = lookUp().getUserProfile(readTicket(), userId);
            if (user!=null) userProfile = new UserProfile(user);
            else logger.error("Error occured while retrieving user profile of user [" + userId + "] from service [" + SERVICE_NAME + "] at endpoint [" + serviceUrl + "]. user is null!");
        } catch (Throwable e) {
            logger.error("Error occured while retrieving user profile of user [" + userId + "] from service [" + SERVICE_NAME + "] at endpoint [" + serviceUrl + "]");
            throw new SecurityException("Error occured while retrieving user profile of user [" + userId + "] from service [" + SERVICE_NAME + "] at endpoint [" + serviceUrl + "]", e);
View Full Code Here

     
      logger.debug("IN");
     
      userProfile = null;
    try {
            SpagoBIUserProfile user = lookUp().getUserProfile(readTicket(), userId);
            if (user!=null) userProfile = new UserProfile(user);
            else logger.error("Error occured while retrieving user profile of user [" + userId + "] from service [" + SERVICE_NAME + "] at endpoint [" + serviceUrl + "]. user is null!");
        } catch (Throwable e) {
            logger.error("Error occured while retrieving user profile of user [" + userId + "] from service [" + SERVICE_NAME + "] at endpoint [" + serviceUrl + "]");
            throw new SecurityException("Error occured while retrieving user profile of user [" + userId + "] from service [" + SERVICE_NAME + "] at endpoint [" + serviceUrl + "]", e);
View Full Code Here

    public SpagoBIUserProfile checkAuthentication(String userId, String psw) {
  logger.debug("IN");
  LDAPConnector conn = LdapConnectorFactory.createLDAPConnector();
  try {
      if ( conn.autenticateUser(userId, psw)){
        SpagoBIUserProfile obj=new SpagoBIUserProfile();
        obj.setUniqueIdentifier(userId);
        obj.setUserId(userId);
        obj.setUserName(userId);
        return obj;
      }else{
        return null;
      }
  } catch (UnsupportedEncodingException e) {
View Full Code Here

TOP

Related Classes of it.eng.spagobi.services.security.bo.SpagoBIUserProfile

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.