Package org.apache.juddi.v3.error

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


 
  public AuthToken getAuthToken(String publisherId)
  throws DispositionReportFaultMessage {

    if (publisherId == null || publisherId.length() == 0)
      throw new UnknownUserException(new ErrorMessage("errors.auth.InvalidCredentials", publisherId));

    EntityManager em = PersistenceManager.getEntityManager();
    EntityTransaction tx = em.getTransaction();
    try {
      tx.begin();
View Full Code Here

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

        int MaxBindingsPerService = -1;
        int MaxServicesPerBusiness = -1;
        int MaxTmodels = -1;
        int MaxBusinesses = -1;
        try {
                MaxBindingsPerService = AppConfig.getConfiguration().getInt(Property.JUDDI_MAX_BINDINGS_PER_SERVICE, -1);
                MaxServicesPerBusiness = AppConfig.getConfiguration().getInt(Property.JUDDI_MAX_SERVICES_PER_BUSINESS, -1);
                MaxTmodels = AppConfig.getConfiguration().getInt(Property.JUDDI_MAX_TMODELS_PER_PUBLISHER, -1);
                MaxBusinesses = AppConfig.getConfiguration().getInt(Property.JUDDI_MAX_BUSINESSES_PER_PUBLISHER, -1);
        } catch (Exception ex) {
                MaxBindingsPerService = -1;
                MaxServicesPerBusiness = -1;
                MaxTmodels = -1;
                MaxBusinesses = -1;
                logger.error("config exception! " + authorizedName, ex);
        }
        boolean isLdapUser = false;
        try {
            env = new Hashtable<String, String>();
            env.put(Context.INITIAL_CONTEXT_FACTORY, AppConfig.getConfiguration().getString(Property.JUDDI_AUTHENTICATOR_INITIAL_CONTEXT, "com.sun.jndi.ldap.LdapCtxFactory"));
            env.put(Context.SECURITY_AUTHENTICATION, AppConfig.getConfiguration().getString(Property.JUDDI_AUTHENTICATOR_STYLE, "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 (ConfigurationException e) {
            logger.error(authorizedName + " is not authenticated", e);
            throw new UnknownUserException(new ErrorMessage("errors.auth.NoPublisher", authorizedName));
        }
        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(MaxBindingsPerService);
                    publisher.setMaxBusinesses(MaxBusinesses);
                    publisher.setMaxServicesPerBusiness(MaxServicesPerBusiness);
                    publisher.setMaxTmodels(MaxTmodels);
                    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

        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

   */
  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"));
    }
    // credential (password) must be specified.
    if (credential == null) {
      throw new UnknownUserException(new ErrorMessage(
      "errors.auth.InvalidCredentials"));
    }
  }
View Full Code Here

  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

  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"));

    // 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

    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

        * @return authorizedName
        * @throws AuthenticationException
        */
        public String authenticate(String authorizedName, String credential) throws AuthenticationException {
                if (authorizedName == null || "".equals(authorizedName)) {
                        throw new UnknownUserException(new ErrorMessage("errors.auth.NoPublisher", authorizedName));
                }
                log.warn("DO NOT USE JUDDI AUTHENTICATOR FOR PRODUCTION SYSTEMS - DOES NOT VALIDATE PASSWORDS, AT ALL!");
                int MaxBindingsPerService = -1;
                int MaxServicesPerBusiness = -1;
                int MaxTmodels = -1;
View Full Code Here

                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()) {
View Full Code Here

TOP

Related Classes of org.apache.juddi.v3.error.UnknownUserException

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.