Package org.jboss.portal.identity

Examples of org.jboss.portal.identity.User


               "Posible data inconsistency");
         }
         SearchResult res = (SearchResult)sr.iterator().next();
         ctx = (Context)res.getObject();
         String dn = ctx.getNameInNamespace();
         User user = createUserInstance(res.getAttributes(), dn);
         ctx.close();
         return user;

      }
      catch (NoSuchElementException e)
View Full Code Here


         InitialContext initialContext = new InitialContext();
         SessionFactory sessionFactory = (SessionFactory)initialContext.lookup("java:/portal/IdentitySessionFactory");
         session = sessionFactory.openSession();
         tx = session.beginTransaction();
        
         User user = this.userModule.findUserByUserName(username);
         if(user != null && user.getUserName().trim().equals(username.trim()))
         {
            Set roles = this.membershipModule.getRoles(user);
            userRoles = new String[roles.size()+1];
            userRoles[0] = "Authenticated";
            int index = 1;
View Full Code Here

         InitialContext initialContext = new InitialContext();
         SessionFactory sessionFactory = (SessionFactory)initialContext.lookup("java:/portal/IdentitySessionFactory");
         session = sessionFactory.openSession();
         tx = session.beginTransaction();
        
         User user = this.userModule.findUserByUserName(username);
         if(user != null && user.getUserName().trim().equals(username.trim()))
         {
            exists = true;
         }
                 
         return exists;
View Full Code Here

         InitialContext initialContext = new InitialContext();
         SessionFactory sessionFactory = (SessionFactory)initialContext.lookup("java:/portal/IdentitySessionFactory");
         session = sessionFactory.openSession();
         tx = session.beginTransaction();
        
         User user = this.userModule.findUserByUserName(username);        
         if(user != null)
         {
            //Check and make sure the user account is enabled
            Boolean enabled = (Boolean)this.profileModule.getProperty(user, User.INFO_USER_ENABLED);
            if(enabled != null && enabled.booleanValue())
            {              
               //Now perform validation
               status = user.validatePassword(password);
            }
         }        
                 
         return status;
      }
View Full Code Here

         InitialContext initialContext = new InitialContext();
         SessionFactory sessionFactory = (SessionFactory)initialContext.lookup("java:/portal/IdentitySessionFactory");
         session = sessionFactory.openSession();
         tx = session.beginTransaction();
        
         User user = this.userModule.findUserByUserName(username);        
         if(user != null)
         {
            //Check and make sure the user account is enabled
            Boolean enabled = (Boolean)this.profileModule.getProperty(user, User.INFO_USER_ENABLED);
            if(enabled != null && enabled.booleanValue())
            {
               //Check and make sure user has proper role setup
               if(this.havingRole != null && this.havingRole.trim().length()>0)
               {
                  boolean hasTheRole = false;
                  Set roles = this.membershipModule.getRoles(user);
                  for (Iterator i = roles.iterator(); i.hasNext();)
                  {
                     Role role = (Role)i.next();
                     if (this.havingRole.equals(role.getName()))
                     {
                        hasTheRole = true;
                        break;
                     }
                  }
                  if (!hasTheRole)
                  {
                     return false;
                  }
               }
              
               //Now perform validation
               status = user.validatePassword(password);
            }
         }        
                 
         return status;
      }
View Full Code Here

               "Posible data inconsistency");
         }
         SearchResult res = (SearchResult)sr.iterator().next();
         ctx = (Context)res.getObject();
         String dn = ctx.getNameInNamespace();
         User user = createUserInstance(res.getAttributes(), dn);
         ctx.close();
         return user;

      }
      catch (NoSuchElementException e)
View Full Code Here

         {
            SearchResult res = (SearchResult)iterator.next();
            DirContext ctx = (DirContext)res.getObject();

            //TODO: this part isn't efficient - check the condition without creating instance
            User user = getUserModule().createUserInstance(res.getAttributes(),ctx.getNameInNamespace());
            if (userNameFilter != null && userNameFilter.length() != 0 && !user.getUserName().matches(".*" + userNameFilter + ".*"))
            {
               ctx.close();
               continue;
            }
            users.add(user);
View Full Code Here

      for (Iterator iterator = users.iterator(); iterator.hasNext();)
      {
         try
         {
            User user = (User)iterator.next();

            if (user instanceof CachedUserImpl)
            {
               try
               {
                  user = getUserModule().findUserById(user.getId());
               }
               catch(NoSuchUserException e)
               {
                  throw new IdentityException("Illegal state - cached user doesn't exist in identity store: ", e);
               }
View Full Code Here

         for (Iterator iterator = users.iterator(); iterator.hasNext();)
         {
            try
            {

               User user = (User)iterator.next();

               if (user instanceof CachedUserImpl)
               {
                  try
                  {
                     user = getUserModule().findUserById(user.getId());
                  }
                  catch(NoSuchUserException e)
                  {
                     throw new IdentityException("Illegal state - cached user doesn't exist in identity store: ", e);
                  }
View Full Code Here

            {
               try
               {


                  User user = null;
                  //check if user exist
                  try
                  {

                     user = getUserModule().findUserByUserName(name);

                     //synchronize password from LDAP to DB
                     if (!user.validatePassword(password))
                     {
                        user.updatePassword(password);
                     }
                  }
                  catch (Exception e)
                  {
                     // nothing as user can simply not exist
View Full Code Here

TOP

Related Classes of org.jboss.portal.identity.User

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.