Package org.jboss.portal.identity

Examples of org.jboss.portal.identity.IdentityException


         {
            this.userModule = (LDAPUserModule)identityContext.getObject(IdentityContext.TYPE_USER_MODULE);
         }
         catch (ClassCastException e)
         {
            throw new IdentityException("Not supported object as part of the context - must be LDAPUserModule", e);
         }
      }
      return userModule;
   }
View Full Code Here


         fireRoleUpdatedEvent(ldapr.getId(), ldapr.getName(), name);
      }
      catch (NamingException e)
      {
         throw new IdentityException("Cannot set role displayName value.", e);
      }
      finally
      {
         try
         {
            ldapContext.close();
         }
         catch (NamingException e)
         {
            throw new IdentityException("Failed to close LDAP connection", e);
         }
      }

   }
View Full Code Here

         //role name
         Attribute uida = attrs.get(getRidAttributeID());
         if (uida == null)
         {
            throw new IdentityException("LDAP entry doesn't contain proper attribute:" + getRidAttributeID());
         }
         //ldapr = new LDAPRoleImpl(uida.getID().concat("=").concat((String)uida.get()) + "," + getContainerDN(), identityContext);
         Attribute display = attrs.get(getDisplayNameAttributeID());
         if (display == null)
         {
            throw new IdentityException("LDAP entry doesn't contain proper attribute:" + getDisplayNameAttributeID());
         }
         ldapr = new LDAPRoleImpl(dn, getIdentityContext(), dn, uida.get().toString(), display.get().toString());
         //ldapr.setDisplayName(display.get().toString());



         log.debug("role uid: " + ldapr.getId());
         log.debug("role dn: " + ldapr.getDn());


      }
      catch (NamingException e)
      {
         throw new IdentityException("Couldn't create LDAPRoleImpl object from ldap entry (SearchResult)", e);
      }

      return ldapr;
   }
View Full Code Here

      {
         log.debug("findRoleByDN(): DN = " + dn);

         if (dn == null)
         {
            throw new IdentityException("Role dn canot be null");
         }


         Attributes attrs = ldapContext.getAttributes(dn);

         if (attrs == null)
         {
            throw new IdentityException("Can't find role entry with DN: " + dn);
         }

         return createRoleInstance(attrs, dn);

      }
      catch (NoSuchElementException e)
      {
         log.debug("No role found with dn: " + dn, e);
      }
      catch (NamingException e)
      {
         throw new IdentityException("Role search failed.", e);
      }
      finally
      {
         try
         {
            ldapContext.close();
         }
         catch (NamingException e)
         {
            throw new IdentityException("Failed to close LDAP connection", e);
         }
      }

      return null;
   }
View Full Code Here

   protected LDAPConnectionContext getConnectionContext() throws IdentityException
   {
      if (connectionContext == null)
      {
         //this.connectionContext = (LDAPConnectionContext)getIdentityContext().getObject(IdentityContext.TYPE_CONNECTION_CONTEXT);
         throw new IdentityException("No LDAPConnectionContext available");
      }
      return connectionContext;
   }
View Full Code Here

   protected String getContainerDN() throws IdentityException
   {
      String cont = getIdentityConfiguration().getValue(IdentityConfiguration.ROLE_CONTAINER_DN);
      if (cont == null)
      {
         throw new IdentityException("Configuration option missing: " + IdentityConfiguration.ROLE_CONTAINER_DN);
      }
      return cont;
   }
View Full Code Here

   protected String getRoleCtxDN() throws IdentityException
   {
      String roleCtx = getIdentityConfiguration().getValue(IdentityConfiguration.ROLE_CONTEXT_DN);
      if (roleCtx == null)
      {
         throw new IdentityException("Configuration option missing: " + IdentityConfiguration.ROLE_CONTEXT_DN);  
      }
      return roleCtx;
   }
View Full Code Here

   protected String getRoleSearchFilter() throws IdentityException
   {
      String searchFilter =  getIdentityConfiguration().getValue(IdentityConfiguration.ROLE_SEARCH_FILTER);
      if (searchFilter == null)
      {
         throw new IdentityException(IdentityConfiguration.ROLE_SEARCH_FILTER + " missing in configuration");
      }
      else
      {
         return searchFilter;
      }
View Full Code Here

      {
         log.debug("findUserByUserName(): username = " + userName);

         if (userName == null)
         {
            throw new IdentityException("User name canot be null");
         }


         String filter = "(".concat(getUidAttributeID()).concat("=").concat(userName).concat(")");
         log.debug("Search filter: " + filter);

         List sr = searchUsers(filter, null);
         if (sr.size() > 1)
         {
            throw new IdentityException("Found more than one user with id: " + userName + "" +
               "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)
      {
         log.debug("No user found with name: " + userName, e);

      }
      catch (NamingException e)
      {
         throw new IdentityException("User search failed.", e);
      }
      finally
      {
         try
         {
            if (ctx != null)
            {
               ctx.close();
            }
         }
         catch (NamingException e)
         {
            throw new IdentityException("Failed to close LDAP connection", e);
         }
      }
      throw new NoSuchUserException("No user found with name: " + userName);

   }
View Full Code Here

   public User findUserById(Object id) throws IdentityException, IllegalArgumentException, NoSuchUserException
   {
      if (id == null)
      {
         throw new IdentityException("Cannot search user with null id");
      }
      if (!(id instanceof String))
      {
         throw new IdentityException("Only String id is suppoted");
      }
      return findUserByDN(id.toString());

   }
View Full Code Here

TOP

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

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.