Examples of UnknownUserException


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);
           
            log.info(authorizedName + " is authenticated");
          
        } catch (NamingException e) {
            log.error(authorizedName + " is not authenticated");
            throw new UnknownUserException(new ErrorMessage("errors.auth.NoPublisher", authorizedName));
        } finally {
            try {
                ctx.close();
            } catch (NamingException e) {
                log.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) {
                    log.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

   *
   * @return the userId that came in on the request providing the user has a publishing account in jUDDI.
   */
  public String authenticate(String authorizedName, String credential) throws AuthenticationException {
    if (authorizedName==null || "".equals(authorizedName)) {
      throw new UnknownUserException(new ErrorMessage("errors.auth.NoPublisher", authorizedName));
    }
    EntityManager em = PersistenceManager.getEntityManager();
    EntityTransaction tx = em.getTransaction();
    try {
      tx.begin();
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

 
  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

Examples of org.jboss.errai.demo.todo.shared.UnknownUserException

    query.setParameter("email", email);
    TodoListUser user;
    try {
      user = query.getSingleResult();
    } catch (NoResultException exception) {
      throw new UnknownUserException("user with email '" + email + "' is not a registered user");
    }

    ShareList shareList;
    try {
      shareList = entityManager.createNamedQuery("mySharedLists", ShareList.class)
View Full Code Here

Examples of org.jresearch.flexess.umi.api.UnknownUserException

  }

  @Override
  public <T> T getAttributeValue(final String userId, final Object attributeId) throws UnknownUserException, ConnectionException {
    if (!users.containsKey(userId)) {
      throw new UnknownUserException(userId);
    }
    return null;
  }
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.