You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juddi.apache.org by ks...@apache.org on 2009/07/01 20:59:54 UTC

svn commit: r790309 - in /webservices/juddi/branches/v3_trunk: docs/ juddi-core/src/main/java/org/apache/juddi/auth/ juddi-core/src/main/java/org/apache/juddi/config/ juddi-core/src/main/resources/juddi_install_data/

Author: kstam
Date: Wed Jul  1 18:59:54 2009
New Revision: 790309

URL: http://svn.apache.org/viewvc?rev=790309&view=rev
Log:
When using jUDDIAuthentication, adding the publisher on the fly if it does not exist.

Removed:
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/juddi_install_data/joepublisher_Publisher.xml
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/juddi_install_data/ssyndicator_Publisher.xml
Modified:
    webservices/juddi/branches/v3_trunk/docs/jUDDI-UserGuide.odt
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/auth/JUDDIAuthenticator.java
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/config/Install.java

Modified: webservices/juddi/branches/v3_trunk/docs/jUDDI-UserGuide.odt
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/docs/jUDDI-UserGuide.odt?rev=790309&r1=790308&r2=790309&view=diff
==============================================================================
Binary files - no diff available.

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/auth/JUDDIAuthenticator.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/auth/JUDDIAuthenticator.java?rev=790309&r1=790308&r2=790309&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/auth/JUDDIAuthenticator.java (original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/auth/JUDDIAuthenticator.java Wed Jul  1 18:59:54 2009
@@ -26,29 +26,47 @@
 import org.apache.juddi.error.ErrorMessage;
 import org.apache.juddi.error.UnknownUserException;
 import org.apache.juddi.model.UddiEntityPublisher;
+import org.apache.log4j.Logger;
 
 /**
  * This is the default implementation of jUDDI's Authenticator interface, which
- * authenticates a request only if the user id has an associated publisher.
+ * if the user id has an associated publisher, and adds the publisher is this is not the
+ * case. Please do NOT use this class in production.
  *
  * @author Steve Viens (sviens@apache.org)
  * @author <a href="mailto:kstam@apache.org">Kurt T Stam</a>
  * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
  */
 public class JUDDIAuthenticator implements Authenticator {
+	
+	private Logger log = Logger.getLogger(this.getClass());
 	/**
 	 * 
 	 * @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();
 			Publisher publisher = em.find(Publisher.class, authorizedName);
-			if (publisher == null)
-				throw new UnknownUserException(new ErrorMessage("errors.auth.NoPublisher", authorizedName));
-			
+			if (publisher == null) {
+				log.info("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();
+			}
 			return authorizedName;
 		} finally {
 			if (tx.isActive()) {

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/config/Install.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/config/Install.java?rev=790309&r1=790308&r2=790309&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/config/Install.java (original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/config/Install.java Wed Jul  1 18:59:54 2009
@@ -93,10 +93,6 @@
 			
 			rootPublisher = installPublisher(em, FILE_ROOT_PUBLISHER, config);
 			uddiPublisher = installPublisher(em, FILE_UDDI_PUBLISHER, config);
-			// TODO:  These do not belong here?
-			// Inserting 2 test publishers
-			installPublisher(em, FILE_JOE_PUBLISHER, config);
-			installPublisher(em, FILE_SSYNDICATOR, config);
 
 			installRootPublisherKeyGen(em, rootTModelKeyGen, rootPartition, rootPublisher, nodeId);
 



---------------------------------------------------------------------
To unsubscribe, e-mail: juddi-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: juddi-cvs-help@ws.apache.org