Examples of UnknownUserException


Examples of org.apache.juddi.error.UnknownUserException

     *
     */
  public String authenticate(final String userID, final String credential)
      throws AuthenticationException {
    if (userID == null) {
      throw new UnknownUserException(new ErrorMessage("errors.auth.InvalidUserId", userID));
    }

    // Create a principal for the userID
    Principal principal = new Principal() {
      public String getName() {
        return userID;
      }
    };

    if (!authManager.isValid(principal, credential)) {
      throw new UnknownUserException(new ErrorMessage("errors.auth.InvalidCredentials"));
    }
    return userID;
  }
View Full Code Here

Examples of org.apache.juddi.error.UnknownUserException

   */
  public boolean isAdministrator(String publisherID)
    throws org.apache.juddi.error.RegistryException
  {
    if ((publisherID == null) || (publisherID.length() == 0))
      throw new UnknownUserException("publisherID = "+publisherID);

    try
    {
      Publisher publisher = PublisherTable.select(publisherID,connection);
      if (publisher == null)
        throw new UnknownUserException("publisherID = "+publisherID);
      else
        return publisher.isAdmin();
    }
    catch(java.sql.SQLException sqlex)
    {
View Full Code Here

Examples of org.apache.juddi.error.UnknownUserException

   */
  public boolean isEnabled(String publisherID)
    throws org.apache.juddi.error.RegistryException
  {
    if ((publisherID == null) || (publisherID.length() == 0))
      throw new UnknownUserException("publisherID = "+publisherID);

    try
    {
      Publisher publisher = PublisherTable.select(publisherID,connection);
      if (publisher == null)
        throw new UnknownUserException("publisherID = "+publisherID);
      else
        return publisher.isEnabled();
    }
    catch(java.sql.SQLException sqlex)
    {
View Full Code Here

Examples of org.apache.juddi.error.UnknownUserException

   */
  public boolean isAdministrator(String publisherID)
    throws org.apache.juddi.error.RegistryException
  {
    if ((publisherID == null) || (publisherID.length() == 0))
      throw new UnknownUserException("publisherID = "+publisherID);

    try
    {
      Publisher publisher = PublisherTable.select(publisherID,connection);
      if (publisher == null)
        throw new UnknownUserException("publisherID = "+publisherID);
      else
        return publisher.isAdmin();
    }
    catch(java.sql.SQLException sqlex)
    {
View Full Code Here

Examples of org.apache.juddi.v3.error.UnknownUserException

    }
   
    public String authenticate(String authorizedName, String cred)
            throws AuthenticationException, FatalErrorException {
        if (authorizedName == null || "".equals(authorizedName)) {
            throw new UnknownUserException(new ErrorMessage("errors.auth.NoPublisher", authorizedName));
        }

        boolean isLdapUser = false;
        try {
            env = new Hashtable<String, String>();
            env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
            env.put(Context.SECURITY_AUTHENTICATION, "simple");
            env.put(Context.PROVIDER_URL, url); // organization ldap url, example ldap://localhost:389
            env.put(Context.SECURITY_PRINCIPAL, authorizedName);
          env.put(Context.SECURITY_CREDENTIALS, cred);
            ctx = new InitialLdapContext(env, null);
            isLdapUser = true;
            logger.info(authorizedName + " is authenticated");
          
        } catch (NamingException e) {
            logger.error(authorizedName + " is not authenticated");
            throw new UnknownUserException(new ErrorMessage("errors.auth.NoPublisher", authorizedName));
        } finally {
            try {
                ctx.close();
            } catch (NamingException e) {
                logger.error("Context close failure " + e);
            }
        }

        if (isLdapUser) {
            EntityManager em = PersistenceManager.getEntityManager();
            EntityTransaction tx = em.getTransaction();
            try {
                tx.begin();
                Publisher publisher = em.find(Publisher.class, authorizedName);
                if (publisher == null) {
                    logger.warn("Publisher was not found, adding the publisher in on the fly.");
                    publisher = new Publisher();
                    publisher.setAuthorizedName(authorizedName);
                    publisher.setIsAdmin("false");
                    publisher.setIsEnabled("true");
                    publisher.setMaxBindingsPerService(199);
                    publisher.setMaxBusinesses(100);
                    publisher.setMaxServicesPerBusiness(100);
                    publisher.setMaxTmodels(100);
                    publisher.setPublisherName("Unknown");
                    em.persist(publisher);
                    tx.commit();
                }
            } finally {
                if (tx.isActive()) {
                    tx.rollback();
                }
                em.close();
            }
        } else {
            throw new UnknownUserException(new ErrorMessage("errors.auth.NoPublisher", authorizedName));
        }
        return authorizedName;
    }
View Full Code Here

Examples of org.apache.juddi.v3.error.UnknownUserException

        EntityTransaction tx = em.getTransaction();
        try {
            tx.begin();
            Publisher publisher = em.find(Publisher.class, authorizedName);
            if (publisher == null)
                throw new UnknownUserException(new ErrorMessage("errors.auth.NoPublisher", authorizedName));
            return publisher;
        } finally {
            if (tx.isActive()) {
                tx.rollback();
            }
View Full Code Here

Examples of org.apache.juddi.v3.error.UnknownUserException

   */
  private void preProcess(String userID, String credential)
  throws AuthenticationException {
    // a userID must be specified.
    if (userID == null) {
      throw new UnknownUserException(new ErrorMessage(
          "errors.auth.InvalidUserId", userID));
    }
    // credential (password) must be specified.
    if (credential == null) {
      throw new UnknownUserException(new ErrorMessage(
      "errors.auth.InvalidCredentials"));
    }
  }
View Full Code Here

Examples of org.apache.juddi.v3.error.UnknownUserException

  throws AuthenticationException {
    if (userTable.containsKey(userID)) {
      User user = (User) userTable.get(userID);
      if ((user.getPassword() == null)
          || (!encryptedCredential.equals(user.getPassword()))) {
        throw new UnknownUserException(new ErrorMessage(
            "errors.auth.InvalidCredentials", userID));
      }
    } else {
      throw new UnknownUserException(new ErrorMessage(
          "errors.auth.InvalidUserId", userID));
    }
    return userID;
  }
View Full Code Here

Examples of org.apache.juddi.v3.error.UnknownUserException

  public String authenticate(String userID,String credential)
  throws AuthenticationException, FatalErrorException
  {
    // a userID must be specified.
    if (userID == null)
      throw new UnknownUserException(new ErrorMessage("errors.auth.InvalidUserId", userID));

    // credential (password) must be specified.
    if (credential == null)
      throw new UnknownUserException(new ErrorMessage("errors.auth.InvalidCredentials"));

    if (userTable.containsKey(userID))
    {
      User user = (User)userTable.get(userID);
      if ((user.getPassword() == null) || (!credential.equals(user.getPassword())))
        throw new UnknownUserException(new ErrorMessage("errors.auth.InvalidCredentials"));
    }
    else
      throw new UnknownUserException(new ErrorMessage("errors.auth.InvalidUserId", userID));

    return userID;
  }
View Full Code Here

Examples of org.apache.juddi.v3.error.UnknownUserException

    EntityTransaction tx = em.getTransaction();
    try {
      tx.begin();
      Publisher publisher = em.find(Publisher.class, authorizedName);
      if (publisher == null)
        throw new UnknownUserException(new ErrorMessage("errors.auth.NoPublisher", authorizedName));
     
      return publisher;
    } finally {
      if (tx.isActive()) {
        tx.rollback();
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.