diff --git a/docs/.gitignore b/docs/.gitignore
deleted file mode 100644
index c1a69fdf9..000000000
--- a/docs/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
-target
-**/target/*
-**/derby.log
-**/.project
-**/.classpath
-**/.settings/*
diff --git a/docs/asciidoc/.gitignore b/docs/asciidoc/.gitignore
deleted file mode 100644
index c1a69fdf9..000000000
--- a/docs/asciidoc/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
-target
-**/target/*
-**/derby.log
-**/.project
-**/.classpath
-**/.settings/*
diff --git a/docs/asciidoc/ClientGuide/.gitignore b/docs/asciidoc/ClientGuide/.gitignore
deleted file mode 100644
index c1a69fdf9..000000000
--- a/docs/asciidoc/ClientGuide/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
-target
-**/target/*
-**/derby.log
-**/.project
-**/.classpath
-**/.settings/*
diff --git a/docs/asciidoc/Guide/.gitignore b/docs/asciidoc/Guide/.gitignore
deleted file mode 100644
index c1a69fdf9..000000000
--- a/docs/asciidoc/Guide/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
-target
-**/target/*
-**/derby.log
-**/.project
-**/.classpath
-**/.settings/*
diff --git a/docs/dist/.gitignore b/docs/dist/.gitignore
deleted file mode 100644
index c1a69fdf9..000000000
--- a/docs/dist/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
-target
-**/target/*
-**/derby.log
-**/.project
-**/.classpath
-**/.settings/*
diff --git a/docs/examples/auth/pom.xml b/docs/examples/auth/pom.xml
index f42954b4e..eab50cf49 100644
--- a/docs/examples/auth/pom.xml
+++ b/docs/examples/auth/pom.xml
@@ -44,7 +44,7 @@
org.apache.juddi
- juddi-core
+ juddi-core-openjpa
${project.parent.version}
compile
diff --git a/juddi-client-cli/.gitignore b/juddi-client-cli/.gitignore
deleted file mode 100644
index c1a69fdf9..000000000
--- a/juddi-client-cli/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
-target
-**/target/*
-**/derby.log
-**/.project
-**/.classpath
-**/.settings/*
diff --git a/juddi-client.net/.gitignore b/juddi-client.net/.gitignore
deleted file mode 100644
index c1a69fdf9..000000000
--- a/juddi-client.net/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
-target
-**/target/*
-**/derby.log
-**/.project
-**/.classpath
-**/.settings/*
diff --git a/juddi-client/.gitignore b/juddi-client/.gitignore
deleted file mode 100644
index d229ff0f1..000000000
--- a/juddi-client/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
-target
-**/target/*
-**/derby.log
-**/.project
-**/.classpath
-**/.settings/
diff --git a/juddi-core-openjpa/.gitignore b/juddi-core-openjpa/.gitignore
deleted file mode 100644
index c1a69fdf9..000000000
--- a/juddi-core-openjpa/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
-target
-**/target/*
-**/derby.log
-**/.project
-**/.classpath
-**/.settings/*
diff --git a/juddi-core-openjpa/pom.xml b/juddi-core-openjpa/pom.xml
index e2adb03ff..d4df8044d 100644
--- a/juddi-core-openjpa/pom.xml
+++ b/juddi-core-openjpa/pom.xml
@@ -30,13 +30,7 @@
OpenJPA.
- ../juddi-core/src/main/java
- ../juddi-core/src/test/java
-
-
- ../juddi-core/src/main/resources
-
-
+
org.apache.felix
@@ -62,7 +56,7 @@
org.apache.openjpa
openjpa-maven-plugin
- 3.1.0
+ 3.2.2
**/org/apache/juddi/model/*.class
true
@@ -82,34 +76,12 @@
org.apache.openjpa
openjpa
- 3.1.0
+ 3.2.2
-
- maven-clean-plugin
- 2.6.1
-
-
-
- src/main/java
-
- **/*
-
- false
-
-
- src/test/java
-
- **/*
-
- false
-
-
-
-
-
+
@@ -140,7 +112,7 @@
org.apache.openjpa
openjpa
- 2.3.0
+ 3.2.2
org.apache.geronimo.specs
diff --git a/juddi-core-openjpa/src/.gitignore b/juddi-core-openjpa/src/.gitignore
deleted file mode 100644
index 95811e001..000000000
--- a/juddi-core-openjpa/src/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/main
diff --git a/juddi-core/src/main/java/org/apache/juddi/ClassUtil.java b/juddi-core-openjpa/src/main/java/org/apache/juddi/ClassUtil.java
similarity index 100%
rename from juddi-core/src/main/java/org/apache/juddi/ClassUtil.java
rename to juddi-core-openjpa/src/main/java/org/apache/juddi/ClassUtil.java
diff --git a/juddi-core/src/main/java/org/apache/juddi/Registry.java b/juddi-core-openjpa/src/main/java/org/apache/juddi/Registry.java
similarity index 100%
rename from juddi-core/src/main/java/org/apache/juddi/Registry.java
rename to juddi-core-openjpa/src/main/java/org/apache/juddi/Registry.java
diff --git a/juddi-core/src/main/java/org/apache/juddi/api/impl/AuthenticatedService.java b/juddi-core-openjpa/src/main/java/org/apache/juddi/api/impl/AuthenticatedService.java
similarity index 98%
rename from juddi-core/src/main/java/org/apache/juddi/api/impl/AuthenticatedService.java
rename to juddi-core-openjpa/src/main/java/org/apache/juddi/api/impl/AuthenticatedService.java
index 5886a5faa..631a0e3ac 100644
--- a/juddi-core/src/main/java/org/apache/juddi/api/impl/AuthenticatedService.java
+++ b/juddi-core-openjpa/src/main/java/org/apache/juddi/api/impl/AuthenticatedService.java
@@ -1,253 +1,253 @@
-/*
- * Copyright 2001-2008 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.juddi.api.impl;
-
-import java.util.Date;
-import javax.annotation.Resource;
-
-import javax.persistence.EntityManager;
-import javax.servlet.http.HttpServletRequest;
-import javax.xml.datatype.DatatypeConfigurationException;
-import javax.xml.datatype.DatatypeFactory;
-import javax.xml.ws.WebServiceContext;
-import javax.xml.ws.handler.MessageContext;
-
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.juddi.config.AppConfig;
-import org.apache.juddi.config.Property;
-import org.apache.juddi.model.UddiEntityPublisher;
-import org.apache.juddi.v3.auth.Authenticator;
-import org.apache.juddi.v3.auth.AuthenticatorFactory;
-import org.apache.juddi.v3.error.AuthTokenRequiredException;
-import org.apache.juddi.v3.error.AuthTokenExpiredException;
-import org.apache.juddi.v3.error.ErrorMessage;
-import org.uddi.v3_service.DispositionReportFaultMessage;
-
-/**
- * Although this class is abstract, it provides token validation
- *
- * @author Jeff Faath
- *
- * @author Alex O'Ree - modified to
- * include token expiration validation
- */
-public abstract class AuthenticatedService {
-
- /**
- * @return the node
- */
- public String getNode() {
- return node;
- }
-
- public static final String UTF8 = "UTF-8";
- public static final int AUTHTOKEN_ACTIVE = 1;
- public static final int AUTHTOKEN_RETIRED = 0;
- static final Log logger = LogFactory.getLog(AuthenticatedService.class);
- /**
- * the node id of this server instance, as loaded from the config file
- */
- private String node = "UNDEFINED_NODE_NAME";
- protected String baseUrlSSL = "UNDEFINED";
- protected String baseUrl = "UNDEFINED";
- protected DatatypeFactory df = null;
-
- public AuthenticatedService() {
- try {
- node = AppConfig.getConfiguration().getString(Property.JUDDI_NODE_ID, "UNDEFINED_NODE_NAME");
- node = node.trim();
- baseUrlSSL = AppConfig.getConfiguration().getString(Property.JUDDI_BASE_URL_SECURE, Property.DEFAULT_BASE_URL_SECURE);
- baseUrlSSL = baseUrlSSL.trim();
- } catch (ConfigurationException ex) {
- logger.fatal(null, ex);
- }
- init();
- }
-
- /**
- * this method can be used to explicitly set a request context. this is useful
- * in unit tests, embedded and in-vm scenarios only
- * @param ctx
- * @since 3.3.8
- */
- public void setContext(WebServiceContext ctx) {
- this.ctx = ctx;
- }
-
- private synchronized void init() {
- try {
- df = DatatypeFactory.newInstance();
- } catch (DatatypeConfigurationException ex) {
- logger.fatal(null, ex);
- }
- }
-
- @Resource
- protected WebServiceContext ctx;
-
- public UddiEntityPublisher getEntityPublisher(EntityManager em, String authInfo) throws DispositionReportFaultMessage {
- boolean useAuthInfo = true;
- try {
- useAuthInfo = AppConfig.getConfiguration().getBoolean(Property.JUDDI_AUTHENTICATOR_USE_TOKEN, true);
- } catch (ConfigurationException ex) {
-
- }
- if (useAuthInfo) {
-
- if (authInfo == null || authInfo.length() == 0) {
- throw new AuthTokenRequiredException(new ErrorMessage("errors.auth.AuthRequired"));
- }
-
- org.apache.juddi.model.AuthToken modelAuthToken = em.find(org.apache.juddi.model.AuthToken.class, authInfo);
- if (modelAuthToken == null) {
- throw new AuthTokenRequiredException(new ErrorMessage("errors.auth.AuthInvalid"));
- }
-
- int allowedMinutesOfInactivity = 0;
- try {
- allowedMinutesOfInactivity = AppConfig.getConfiguration().getInt(Property.JUDDI_AUTH_TOKEN_TIMEOUT, 0);
- } catch (ConfigurationException ce) {
- logger.error("Error reading property " + Property.JUDDI_AUTH_TOKEN_EXPIRATION + " from "
- + "the application's configuration. No automatic timeout token invalidation will occur. "
- + ce.getMessage(), ce);
- }
- int maxMinutesOfAge = 0;
- try {
- maxMinutesOfAge = AppConfig.getConfiguration().getInt(Property.JUDDI_AUTH_TOKEN_EXPIRATION, 0);
- } catch (ConfigurationException ce) {
- logger.error("Error reading property " + Property.JUDDI_AUTH_TOKEN_EXPIRATION + " from "
- + "the application's configuration. No automatic timeout token invalidation will occur. "
- + ce.getMessage(), ce);
- }
- Date now = new Date();
- // 0 or negative means token does not expire
- if (allowedMinutesOfInactivity > 0) {
- // expire tokens after # minutes of inactivity
- // compare the time in milli-seconds
- if (now.getTime() > modelAuthToken.getLastUsed().getTime() + allowedMinutesOfInactivity * 60000l) {
- logger.info("AUDIT: FAILTURE Token " + modelAuthToken.getAuthToken() + " expired due to inactivity " + getRequestorsIPAddress());
- modelAuthToken.setTokenState(AUTHTOKEN_RETIRED);
- }
- }
- if (maxMinutesOfAge > 0) {
- // expire tokens when max age is reached
- // compare the time in milli-seconds
- if (now.getTime() > modelAuthToken.getCreated().getTime() + maxMinutesOfAge * 60000l) {
-
- logger.info("AUDIT: FAILURE - Token " + modelAuthToken.getAuthorizedName() + " expired due to old age " + getRequestorsIPAddress());
- modelAuthToken.setTokenState(AUTHTOKEN_RETIRED);
- }
- }
-
- if (modelAuthToken.getTokenState() == AUTHTOKEN_RETIRED) {
-
- throw new AuthTokenExpiredException(new ErrorMessage("errors.auth.AuthTokenExpired"));
- }
- if (ctx != null) {
- try {
- boolean check = true;
- try {
- check = AppConfig.getConfiguration().getBoolean(Property.JUDDI_AUTH_TOKEN_ENFORCE_SAME_IP, true);
- } catch (ConfigurationException ex) {
- logger.warn("Error loading config property " + Property.JUDDI_AUTH_TOKEN_ENFORCE_SAME_IP
- + " Enforcing Same IP for Auth Tokens will be enabled by default", ex);
- }
- if (check) {
- MessageContext mc = ctx.getMessageContext();
- HttpServletRequest req = null;
- if (mc != null) {
- req = (HttpServletRequest) mc.get(MessageContext.SERVLET_REQUEST);
- }
- if (req != null
- && req.getRemoteAddr() != null
- && modelAuthToken.getIPAddress() != null
- && !modelAuthToken.getIPAddress().equalsIgnoreCase(req.getRemoteAddr())) {
- modelAuthToken.setTokenState(AUTHTOKEN_RETIRED);
- logger.error("AUDIT FAILURE - Security Alert - Attempt to use issued auth token from a different IP address, user "
- + modelAuthToken.getAuthorizedName() + ", issued IP " + modelAuthToken.getIPAddress()
- + ", attempted use from " + req.getRemoteAddr() + ", forcing reauthentication.");
- throw new AuthTokenRequiredException(new ErrorMessage("errors.auth.AuthInvalid"));
- //invalidate the token, someone's intercepted it or it was reused on another ip
- }
- }
- } catch (Exception ex) {
- if (ex instanceof AuthTokenRequiredException) {
- throw (AuthTokenRequiredException) ex;
- }
- logger.error("unexpected error caught looking up requestor's ip address", ex);
- }
-
- }
- Authenticator authenticator = AuthenticatorFactory.getAuthenticator();
- UddiEntityPublisher entityPublisher = authenticator.identify(authInfo, modelAuthToken.getAuthorizedName(), ctx);
-
- // Must make sure the returned publisher has all the necessary fields filled
- if (entityPublisher == null) {
- logger.warn("AUDIT FAILURE - Auth token invalid, publisher does not exist " + getRequestorsIPAddress());
- throw new AuthTokenRequiredException(new ErrorMessage("errors.auth.AuthInvalid"));
- }
- if (entityPublisher.getAuthorizedName() == null) {
- logger.warn("AUDIT FAILURE - Auth token invalid, username does exist" + getRequestorsIPAddress());
- throw new AuthTokenRequiredException(new ErrorMessage("errors.auth.AuthInvalid"));
- }
- // Auth token is being used. Adjust appropriate values so that it's internal 'expiration clock' is reset.
- modelAuthToken.setLastUsed(new Date());
- modelAuthToken.setNumberOfUses(modelAuthToken.getNumberOfUses() + 1);
- return entityPublisher;
- } else {
- //use non-token based authentication
- Authenticator authenticator = AuthenticatorFactory.getAuthenticator();
- UddiEntityPublisher entityPublisher = authenticator.identify(null, null, ctx);
- // Must make sure the returned publisher has all the necessary fields filled
- if (entityPublisher == null) {
- logger.warn("AUDIT FAILURE - Auth token invalid, publisher does not exist " + getRequestorsIPAddress());
- throw new AuthTokenRequiredException(new ErrorMessage("errors.auth.AuthInvalid"));
- }
- if (entityPublisher.getAuthorizedName() == null) {
- logger.warn("AUDIT FAILURE - Auth token invalid, username does exist" + getRequestorsIPAddress());
- throw new AuthTokenRequiredException(new ErrorMessage("errors.auth.AuthInvalid"));
- }
- return entityPublisher;
-
- }
-
- }
-
- /**
- * Attempts to get the requestor's ip address from the servlet context,
- * defaults to null it it can't be retrieved
- *
- * @return requestor's ip address or null if it's not available
- */
- public String getRequestorsIPAddress() {
- try {
- MessageContext mc = ctx.getMessageContext();
- HttpServletRequest req = null;
- if (mc != null) {
- req = (HttpServletRequest) mc.get(MessageContext.SERVLET_REQUEST);
- }
- if (req != null) {
- return req.getRemoteAddr();
- }
- } catch (Exception ex) {
- logger.debug("Error caught looking up the requestor's ip address", ex);
- }
- return null;
- }
-}
+/*
+ * Copyright 2001-2008 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.juddi.api.impl;
+
+import java.util.Date;
+import javax.annotation.Resource;
+
+import javax.persistence.EntityManager;
+import javax.servlet.http.HttpServletRequest;
+import javax.xml.datatype.DatatypeConfigurationException;
+import javax.xml.datatype.DatatypeFactory;
+import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.handler.MessageContext;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.juddi.config.AppConfig;
+import org.apache.juddi.config.Property;
+import org.apache.juddi.model.UddiEntityPublisher;
+import org.apache.juddi.v3.auth.Authenticator;
+import org.apache.juddi.v3.auth.AuthenticatorFactory;
+import org.apache.juddi.v3.error.AuthTokenRequiredException;
+import org.apache.juddi.v3.error.AuthTokenExpiredException;
+import org.apache.juddi.v3.error.ErrorMessage;
+import org.uddi.v3_service.DispositionReportFaultMessage;
+
+/**
+ * Although this class is abstract, it provides token validation
+ *
+ * @author Jeff Faath
+ *
+ * @author Alex O'Ree - modified to
+ * include token expiration validation
+ */
+public abstract class AuthenticatedService {
+
+ /**
+ * @return the node
+ */
+ public String getNode() {
+ return node;
+ }
+
+ public static final String UTF8 = "UTF-8";
+ public static final int AUTHTOKEN_ACTIVE = 1;
+ public static final int AUTHTOKEN_RETIRED = 0;
+ static final Log logger = LogFactory.getLog(AuthenticatedService.class);
+ /**
+ * the node id of this server instance, as loaded from the config file
+ */
+ private String node = "UNDEFINED_NODE_NAME";
+ protected String baseUrlSSL = "UNDEFINED";
+ protected String baseUrl = "UNDEFINED";
+ protected DatatypeFactory df = null;
+
+ public AuthenticatedService() {
+ try {
+ node = AppConfig.getConfiguration().getString(Property.JUDDI_NODE_ID, "UNDEFINED_NODE_NAME");
+ node = node.trim();
+ baseUrlSSL = AppConfig.getConfiguration().getString(Property.JUDDI_BASE_URL_SECURE, Property.DEFAULT_BASE_URL_SECURE);
+ baseUrlSSL = baseUrlSSL.trim();
+ } catch (ConfigurationException ex) {
+ logger.fatal(null, ex);
+ }
+ init();
+ }
+
+ /**
+ * this method can be used to explicitly set a request context. this is useful
+ * in unit tests, embedded and in-vm scenarios only
+ * @param ctx
+ * @since 3.3.8
+ */
+ public void setContext(WebServiceContext ctx) {
+ this.ctx = ctx;
+ }
+
+ private synchronized void init() {
+ try {
+ df = DatatypeFactory.newInstance();
+ } catch (DatatypeConfigurationException ex) {
+ logger.fatal(null, ex);
+ }
+ }
+
+ @Resource
+ protected WebServiceContext ctx;
+
+ public UddiEntityPublisher getEntityPublisher(EntityManager em, String authInfo) throws DispositionReportFaultMessage {
+ boolean useAuthInfo = true;
+ try {
+ useAuthInfo = AppConfig.getConfiguration().getBoolean(Property.JUDDI_AUTHENTICATOR_USE_TOKEN, true);
+ } catch (ConfigurationException ex) {
+
+ }
+ if (useAuthInfo) {
+
+ if (authInfo == null || authInfo.length() == 0) {
+ throw new AuthTokenRequiredException(new ErrorMessage("errors.auth.AuthRequired"));
+ }
+
+ org.apache.juddi.model.AuthToken modelAuthToken = em.find(org.apache.juddi.model.AuthToken.class, authInfo);
+ if (modelAuthToken == null) {
+ throw new AuthTokenRequiredException(new ErrorMessage("errors.auth.AuthInvalid"));
+ }
+
+ int allowedMinutesOfInactivity = 0;
+ try {
+ allowedMinutesOfInactivity = AppConfig.getConfiguration().getInt(Property.JUDDI_AUTH_TOKEN_TIMEOUT, 0);
+ } catch (ConfigurationException ce) {
+ logger.error("Error reading property " + Property.JUDDI_AUTH_TOKEN_EXPIRATION + " from "
+ + "the application's configuration. No automatic timeout token invalidation will occur. "
+ + ce.getMessage(), ce);
+ }
+ int maxMinutesOfAge = 0;
+ try {
+ maxMinutesOfAge = AppConfig.getConfiguration().getInt(Property.JUDDI_AUTH_TOKEN_EXPIRATION, 0);
+ } catch (ConfigurationException ce) {
+ logger.error("Error reading property " + Property.JUDDI_AUTH_TOKEN_EXPIRATION + " from "
+ + "the application's configuration. No automatic timeout token invalidation will occur. "
+ + ce.getMessage(), ce);
+ }
+ Date now = new Date();
+ // 0 or negative means token does not expire
+ if (allowedMinutesOfInactivity > 0) {
+ // expire tokens after # minutes of inactivity
+ // compare the time in milli-seconds
+ if (now.getTime() > modelAuthToken.getLastUsed().getTime() + allowedMinutesOfInactivity * 60000l) {
+ logger.info("AUDIT: FAILTURE Token " + modelAuthToken.getAuthToken() + " expired due to inactivity " + getRequestorsIPAddress());
+ modelAuthToken.setTokenState(AUTHTOKEN_RETIRED);
+ }
+ }
+ if (maxMinutesOfAge > 0) {
+ // expire tokens when max age is reached
+ // compare the time in milli-seconds
+ if (now.getTime() > modelAuthToken.getCreated().getTime() + maxMinutesOfAge * 60000l) {
+
+ logger.info("AUDIT: FAILURE - Token " + modelAuthToken.getAuthorizedName() + " expired due to old age " + getRequestorsIPAddress());
+ modelAuthToken.setTokenState(AUTHTOKEN_RETIRED);
+ }
+ }
+
+ if (modelAuthToken.getTokenState() == AUTHTOKEN_RETIRED) {
+
+ throw new AuthTokenExpiredException(new ErrorMessage("errors.auth.AuthTokenExpired"));
+ }
+ if (ctx != null) {
+ try {
+ boolean check = true;
+ try {
+ check = AppConfig.getConfiguration().getBoolean(Property.JUDDI_AUTH_TOKEN_ENFORCE_SAME_IP, true);
+ } catch (ConfigurationException ex) {
+ logger.warn("Error loading config property " + Property.JUDDI_AUTH_TOKEN_ENFORCE_SAME_IP
+ + " Enforcing Same IP for Auth Tokens will be enabled by default", ex);
+ }
+ if (check) {
+ MessageContext mc = ctx.getMessageContext();
+ HttpServletRequest req = null;
+ if (mc != null) {
+ req = (HttpServletRequest) mc.get(MessageContext.SERVLET_REQUEST);
+ }
+ if (req != null
+ && req.getRemoteAddr() != null
+ && modelAuthToken.getIPAddress() != null
+ && !modelAuthToken.getIPAddress().equalsIgnoreCase(req.getRemoteAddr())) {
+ modelAuthToken.setTokenState(AUTHTOKEN_RETIRED);
+ logger.error("AUDIT FAILURE - Security Alert - Attempt to use issued auth token from a different IP address, user "
+ + modelAuthToken.getAuthorizedName() + ", issued IP " + modelAuthToken.getIPAddress()
+ + ", attempted use from " + req.getRemoteAddr() + ", forcing reauthentication.");
+ throw new AuthTokenRequiredException(new ErrorMessage("errors.auth.AuthInvalid"));
+ //invalidate the token, someone's intercepted it or it was reused on another ip
+ }
+ }
+ } catch (Exception ex) {
+ if (ex instanceof AuthTokenRequiredException) {
+ throw (AuthTokenRequiredException) ex;
+ }
+ logger.error("unexpected error caught looking up requestor's ip address", ex);
+ }
+
+ }
+ Authenticator authenticator = AuthenticatorFactory.getAuthenticator();
+ UddiEntityPublisher entityPublisher = authenticator.identify(authInfo, modelAuthToken.getAuthorizedName(), ctx);
+
+ // Must make sure the returned publisher has all the necessary fields filled
+ if (entityPublisher == null) {
+ logger.warn("AUDIT FAILURE - Auth token invalid, publisher does not exist " + getRequestorsIPAddress());
+ throw new AuthTokenRequiredException(new ErrorMessage("errors.auth.AuthInvalid"));
+ }
+ if (entityPublisher.getAuthorizedName() == null) {
+ logger.warn("AUDIT FAILURE - Auth token invalid, username does exist" + getRequestorsIPAddress());
+ throw new AuthTokenRequiredException(new ErrorMessage("errors.auth.AuthInvalid"));
+ }
+ // Auth token is being used. Adjust appropriate values so that it's internal 'expiration clock' is reset.
+ modelAuthToken.setLastUsed(new Date());
+ modelAuthToken.setNumberOfUses(modelAuthToken.getNumberOfUses() + 1);
+ return entityPublisher;
+ } else {
+ //use non-token based authentication
+ Authenticator authenticator = AuthenticatorFactory.getAuthenticator();
+ UddiEntityPublisher entityPublisher = authenticator.identify(null, null, ctx);
+ // Must make sure the returned publisher has all the necessary fields filled
+ if (entityPublisher == null) {
+ logger.warn("AUDIT FAILURE - Auth token invalid, publisher does not exist " + getRequestorsIPAddress());
+ throw new AuthTokenRequiredException(new ErrorMessage("errors.auth.AuthInvalid"));
+ }
+ if (entityPublisher.getAuthorizedName() == null) {
+ logger.warn("AUDIT FAILURE - Auth token invalid, username does exist" + getRequestorsIPAddress());
+ throw new AuthTokenRequiredException(new ErrorMessage("errors.auth.AuthInvalid"));
+ }
+ return entityPublisher;
+
+ }
+
+ }
+
+ /**
+ * Attempts to get the requestor's ip address from the servlet context,
+ * defaults to null it it can't be retrieved
+ *
+ * @return requestor's ip address or null if it's not available
+ */
+ public String getRequestorsIPAddress() {
+ try {
+ MessageContext mc = ctx.getMessageContext();
+ HttpServletRequest req = null;
+ if (mc != null) {
+ req = (HttpServletRequest) mc.get(MessageContext.SERVLET_REQUEST);
+ }
+ if (req != null) {
+ return req.getRemoteAddr();
+ }
+ } catch (Exception ex) {
+ logger.debug("Error caught looking up the requestor's ip address", ex);
+ }
+ return null;
+ }
+}
diff --git a/juddi-core/src/main/java/org/apache/juddi/api/impl/InquiryHelper.java b/juddi-core-openjpa/src/main/java/org/apache/juddi/api/impl/InquiryHelper.java
similarity index 97%
rename from juddi-core/src/main/java/org/apache/juddi/api/impl/InquiryHelper.java
rename to juddi-core-openjpa/src/main/java/org/apache/juddi/api/impl/InquiryHelper.java
index b4b88ed55..691314648 100644
--- a/juddi-core/src/main/java/org/apache/juddi/api/impl/InquiryHelper.java
+++ b/juddi-core-openjpa/src/main/java/org/apache/juddi/api/impl/InquiryHelper.java
@@ -1,650 +1,650 @@
-/*
- * Copyright 2001-2008 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.juddi.api.impl;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.LinkedList;
-import java.util.List;
-
-import javax.persistence.EntityManager;
-import javax.xml.ws.Holder;
-import org.apache.commons.configuration.ConfigurationException;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.juddi.config.AppConfig;
-import org.apache.juddi.config.Property;
-import org.apache.juddi.mapping.MappingModelToApi;
-import org.apache.juddi.model.BindingTemplate;
-import org.apache.juddi.query.FetchBindingTemplatesQuery;
-import org.apache.juddi.query.FetchBusinessEntitiesQuery;
-import org.apache.juddi.query.FetchBusinessServicesQuery;
-import org.apache.juddi.query.FetchTModelsQuery;
-import org.apache.juddi.query.FindBindingByCategoryGroupQuery;
-import org.apache.juddi.query.FindBindingByCategoryQuery;
-import org.apache.juddi.query.FindBindingByTModelKeyQuery;
-import org.apache.juddi.query.FindBusinessByCategoryGroupQuery;
-import org.apache.juddi.query.FindBusinessByCategoryQuery;
-import org.apache.juddi.query.FindBusinessByCombinedCategoryQuery;
-import org.apache.juddi.query.FindBusinessByDiscoveryURLQuery;
-import org.apache.juddi.query.FindBusinessByIdentifierQuery;
-import org.apache.juddi.query.FindBusinessByNameQuery;
-import org.apache.juddi.query.FindBusinessByTModelKeyQuery;
-import org.apache.juddi.query.FindServiceByCategoryGroupQuery;
-import org.apache.juddi.query.FindServiceByCategoryQuery;
-import org.apache.juddi.query.FindServiceByCombinedCategoryQuery;
-import org.apache.juddi.query.FindServiceByNameQuery;
-import org.apache.juddi.query.FindServiceByTModelKeyQuery;
-import org.apache.juddi.query.FindTModelByCategoryGroupQuery;
-import org.apache.juddi.query.FindTModelByCategoryQuery;
-import org.apache.juddi.query.FindTModelByIdentifierQuery;
-import org.apache.juddi.query.FindTModelByNameQuery;
-import org.apache.juddi.query.util.FindQualifiers;
-import org.apache.juddi.v3.error.ErrorMessage;
-import org.apache.juddi.v3.error.InvalidKeyPassedException;
-import org.uddi.api_v3.BindingDetail;
-import org.uddi.api_v3.BusinessList;
-import org.uddi.api_v3.Direction;
-import org.uddi.api_v3.FindBinding;
-import org.uddi.api_v3.FindBusiness;
-import org.uddi.api_v3.FindRelatedBusinesses;
-import org.uddi.api_v3.FindService;
-import org.uddi.api_v3.FindTModel;
-import org.uddi.api_v3.ListDescription;
-import org.uddi.api_v3.Name;
-import org.uddi.api_v3.RelatedBusinessesList;
-import org.uddi.api_v3.ServiceList;
-import org.uddi.api_v3.TModelBag;
-import org.uddi.api_v3.TModelList;
-import org.uddi.v3_service.DispositionReportFaultMessage;
-
-/**Co
- * Used to factor out inquiry functionality as it is used in more than one spot.
- *
- * @author Jeff Faath
- */
-public class InquiryHelper {
-
- private static Log logger = LogFactory.getLog(InquiryHelper.class);
-
- public static List