Examples of IdentityException


Examples of com.esri.gpt.framework.security.identity.IdentityException

  try {
    LdapClient client = newLdapClient();
    client.connect();
    return client;
  } catch (Exception e) {
    throw new IdentityException("Unable to connect to LDAP.",e);
  }
}
View Full Code Here

Examples of org.jboss.identity.idm.common.exception.IdentityException

            String cacheConfig = configurationMD.getOptionSingleValue(CACHE_CONFIG_FILE_OPTION);
            String cacheSupportClass = configurationMD.getOptionSingleValue(CACHE_PROVIDER_CLASS_OPTION);

            if (cacheConfig == null)
            {
               throw new IdentityException(CACHE_CONFIG_FILE_OPTION + " is missing in the repository configuration");
            }

            if (cacheSupportClass == null)
            {
               throw new IdentityException(CACHE_PROVIDER_CLASS_OPTION + " is missing in the repository configuration");
            }

            ClassLoader classLoader = SecurityActions.getContextClassLoader();
            InputStream cacheConfigInputStream = classLoader.getResourceAsStream(cacheConfig);
            if (cacheConfigInputStream == null)
            {
               throw new IdentityException("JBoss Cache config file specified in option \"" + CACHE_CONFIG_FILE_OPTION +
                  "\" doesn't exist: " + cacheConfig);
            }



            try
            {
               Class cacheClass = null;
               cacheClass = Class.forName(cacheSupportClass);

               Class partypes[] = new Class[1];
               partypes[0] = InputStream.class;

               Constructor ct = cacheClass.getConstructor(partypes);
               Object argList[] = new Object[1];
               argList[0] = cacheConfigInputStream;


               IdentityStoreCacheProvider cacheSupport = (IdentityStoreCacheProvider)ct.newInstance(argList);

               defaultIdentityStore = new JBossCacheIdentityStoreWrapper(defaultIdentityStore, cacheSupport);


            }
            catch (Exception e)
            {
               throw new IdentityException("Cannot instantiate cache provider:" + cacheSupportClass, e);
            }



         }
      }

      for (IdentityStoreMappingMetaData identityStoreMappingMetaData : configurationMD.getIdentityStoreToIdentityObjectTypeMappings())
      {
         String storeId = identityStoreMappingMetaData.getIdentityStoreId();
         List<String> identityObjectTypeMappings = identityStoreMappingMetaData.getIdentityObjectTypeMappings();

         IdentityStore store = bootstrappedIdentityStores.get(storeId);

         String cacheOption = identityStoreMappingMetaData.getOptionSingleValue(CACHE_OPTION);


         if (cacheOption != null && cacheOption.equalsIgnoreCase("true"))
         {
            String cacheConfig = identityStoreMappingMetaData.getOptionSingleValue(CACHE_CONFIG_FILE_OPTION);
            String cacheSupportClass = identityStoreMappingMetaData.getOptionSingleValue(CACHE_PROVIDER_CLASS_OPTION);


            if (cacheConfig == null)
            {
               throw new IdentityException(CACHE_CONFIG_FILE_OPTION + " is missing in the repository identity-store-mapping configuration");
            }

            if (cacheSupportClass == null)
            {
               throw new IdentityException(CACHE_PROVIDER_CLASS_OPTION + " is missing in the repository configuration");
            }

            ClassLoader classLoader = SecurityActions.getContextClassLoader();
            InputStream cacheConfigInputStream = classLoader.getResourceAsStream(cacheConfig);
            if (cacheConfigInputStream == null)
            {
               throw new IdentityException("JBoss Cache config file specified in option \"" + CACHE_CONFIG_FILE_OPTION +
                  "\" doesn't exist: " + cacheConfig);
            }

            try
            {
               Class cacheClass = null;
               cacheClass = Class.forName(cacheSupportClass);

               Class partypes[] = new Class[1];
               partypes[0] = InputStream.class;

               Constructor ct = cacheClass.getConstructor(partypes);
               Object argList[] = new Object[1];
               argList[0] = cacheConfigInputStream;


               IdentityStoreCacheProvider cacheSupport = (IdentityStoreCacheProvider)ct.newInstance(argList);

               store = new JBossCacheIdentityStoreWrapper(store, cacheSupport);

            }
            catch (Exception e)
            {
               throw new IdentityException("Cannot instantiate cache provider:" + cacheSupportClass, e);
            }


         }

         if (store == null)
         {
            throw new IdentityException("Mapped IdentityStore not available: " + storeId);
         }

         for (String mapping : identityObjectTypeMappings)
         {
            identityStoreMappings.put(mapping, store);
View Full Code Here

Examples of org.jboss.identity.idm.exception.IdentityException

         //Handle only those credentials that implement SPI

         if (!(credential instanceof IdentityObjectCredential))
         {
            throw new IdentityException("Unsupported Credential implementation: " + credential.getClass());
         }

         ioc = (IdentityObjectCredential)credential;

         // All credentials must pass
View Full Code Here

Examples of org.jboss.portal.identity.IdentityException

      {
         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

Examples of org.jboss.portal.identity.IdentityException

   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

Examples of org.jboss.portal.identity.IdentityException

   public User createUser(String userName, String password) throws IdentityException, IllegalArgumentException
   {

      if (userName == null)
      {
         throw new IdentityException("User name cannot be null");
      }
      /*if (realEmail == null)
      {
         throw new IdentityException("User email cannot be null");
      }*/
      if (password == null)
      {
         throw new IdentityException("User password cannot be null");
      }

      log.debug("Creating user: " + userName);


      LdapContext ldapContext = getConnectionContext().createInitialContext();

      try
      {
         //
         LdapContext ctx = (LdapContext)ldapContext.lookup(getContainerDN());

         //We store new entry using set of attributes. This should give more flexibility then
         //extending user object from ContextDir - configure what objectClass place there
         Attributes attrs = new BasicAttributes(true);

         //create attribute using provided configuration
         Map attributesToAdd = getAttributesToAdd();

         //attributes
         for (Iterator it1 = attributesToAdd.keySet().iterator(); it1.hasNext();)
         {
            String attributeName = (String)it1.next();
            if (getUidAttributeID().equals(attributeName))
            {
               continue;
            }
            log.debug("adding attribute: " + attributeName);
            Attribute attr = new BasicAttribute(attributeName);
            Set attributeValues = (Set)attributesToAdd.get(attributeName);

            //values
            for (Iterator it2 = attributeValues.iterator(); it2.hasNext();)
            {
               String attrValue = (String)it2.next();
               log.debug("adding attribute value: " + attrValue);
               attr.add(attrValue);
            }
            attrs.put(attr);
         }

         if (!isSetPasswordAfterUserCreate())
         {
            attrs.put(getPasswordAttributeId(), password);
         }

         String validUserName = LDAPTools.encodeRfc2253Name(userName);

         String dn = getUidAttributeID().concat("=").concat(validUserName);

         log.debug("creating ldap entry for: " + dn + "; " + attrs);
         ctx.createSubcontext(dn, attrs);


      }
      catch (Exception e)
      {
         throw new IdentityException("Failed to create user", e);
      }
      finally
      {
         try
         {
            ldapContext.close();
         }
         catch (NamingException e)
         {
            throw new IdentityException("Failed to close LDAP connection", e);
         }
      }

      LDAPUserImpl u =  (LDAPUserImpl)findUserByUserName(userName);

View Full Code Here

Examples of org.jboss.portal.identity.IdentityException

      String userName = ldapu.getUserName();

      if (ldapu == null)
      {
         throw new IdentityException("Cannot find user for removal");
      }

      if (ldapu.getDn() == null)
      {
         throw new IdentityException("Cannot obtain DN of user");
      }

      LdapContext ldapContext = getConnectionContext().createInitialContext();

      try
      {
         log.debug("removing entry: " + ldapu.getDn());
         ldapContext.unbind(ldapu.getDn());
      }
      catch (Exception e)
      {
         throw new IdentityException("Failed to remove user: ", e);
      }
      finally
      {
         try
         {
            ldapContext.close();
         }
         catch (NamingException e)
         {
            throw new IdentityException("Failed to close LDAP connection", e);
         }
      }


      //user was successfull removed so fire events
View Full Code Here

Examples of org.jboss.portal.identity.IdentityException

      //log.info("Current implementation of findUsersFilteredByUserName returns all users and is not \"offset\" and \"limit\" sensitive ");

      if (limit == 0)
      {
         throw new IdentityException("Search limit shouldn't be set to 0");
      }

      List uf = new LinkedList();
      Enumeration results = null;


      if (filter.length() == 0)
      {
         filter = "*";
      }
      else if (!(filter.length() == && filter.equals("*")))
      {
         filter = "*" + filter + "*";
      }

      try
      {
         //search all entries containing "uid" attribute
         String ldap_filter = "(".concat(getUidAttributeID()).concat("=").concat(filter).concat(")");
         log.debug("Search filter: " + filter);



         uf = searchUsers(ldap_filter, null);

         int size = uf.size();
         if (offset == 0 && size <= limit)
         {
            return processUsers(uf);
         }

         Collections.sort(uf, new UserEntryComparator());

         if (offset + limit <= size)
         {
            return processUsers(uf.subList(offset, offset + limit));
         }
         else if (offset >= size)
         {
            return new HashSet();
         }

         return processUsers(uf.subList(offset, size));
      }
      catch (NoSuchElementException e)
      {
         log.debug("No users found", e);
      }
      catch (Throwable e)
      {
         throw new IdentityException("User search failed.", e);
      }

      //won't happen
      return null;

View Full Code Here

Examples of org.jboss.portal.identity.IdentityException

      {
         log.debug("No users found", e);
      }
      catch (Exception e)
      {
         throw new IdentityException("User search failed.", e);
      }
      return 0;
   }
View Full Code Here

Examples of org.picketlink.idm.common.exception.IdentityException

    @RequestScoped
    IdentitySession createIdentitySession(IdentitySessionFactory factory)
            throws IdentityException {
       
        if (metadata.getRepositories() == null || metadata.getRepositories().size() == 0) {
            throw new IdentityException("Error creating IdentitySession - no PicketLink IdentityStore repositories have been configured.");
        }
       
        Map<String, Object> sessionOptions = new HashMap<String, Object>();

        if (!entityManagerInstance.isUnsatisfied() && !entityManagerInstance.isAmbiguous()) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.