From 81997a24ccdff4155e727f59a9bd72c1cf25ffa0 Mon Sep 17 00:00:00 2001 From: Benjamin Phillippe Date: Thu, 24 Jul 2014 11:21:00 -0500 Subject: [PATCH] Omaha #3255 Fixing dependencies to fix the DPA Change-Id: If2625cda7b73b52b6e79f3a6b8ac580dbcf1ecc9 Former-commit-id: 075bb856689e8eaa95ee7721b6270c3a785c9bd4 --- .../build.edex/esb/etc/centralRegistry.sh | 2 +- .../res/spring/ebxml-impl.xml | 21 ----------- .../res/spring/ebxml-webservices.xml | 36 ++++++++++++++----- .../res/spring/ebxml-xacml.xml | 5 +++ .../registry/ebxml/acp/PasswordCallback.java | 15 +++++++- .../ebxml/web/security/CredentialCache.java | 13 +------ .../web/security/RegistryLoginModule.java | 24 +++++++++---- .../res/spring/edex-security.xml | 2 ++ 8 files changed, 68 insertions(+), 50 deletions(-) diff --git a/edexOsgi/build.edex/esb/etc/centralRegistry.sh b/edexOsgi/build.edex/esb/etc/centralRegistry.sh index 9d235c5b8c..859465976a 100644 --- a/edexOsgi/build.edex/esb/etc/centralRegistry.sh +++ b/edexOsgi/build.edex/esb/etc/centralRegistry.sh @@ -19,7 +19,7 @@ # further licensing information. ## -export MAX_MEM=1536 # in Meg +export MAX_MEM=2048 # in Meg export MAX_PERM_SIZE=192m export EDEX_DEBUG_PORT=5011 export EDEX_JMX_PORT=1622 diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-impl.xml b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-impl.xml index 96e459a057..4a7924e7a6 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-impl.xml +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-impl.xml @@ -1,8 +1,6 @@ - - @@ -39,25 +37,6 @@ - - - - - - - - - - - - - - - - - - - + + + + + class="com.raytheon.uf.edex.registry.ebxml.web.security.CredentialCache"> @@ -18,6 +21,7 @@ + @@ -30,11 +34,6 @@ - - - - - @@ -52,14 +51,33 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + * @@ -49,6 +50,9 @@ import com.raytheon.uf.edex.registry.ebxml.web.security.CredentialCache; * @version 1.0 */ public class PasswordCallback implements CallbackHandler { + + /** Cache of user credentials */ + private CredentialCache credentialCache; /** * Creates a new PasswordCallback @@ -62,9 +66,18 @@ public class PasswordCallback implements CallbackHandler { for (Callback call : callbacks) { if (call instanceof WSPasswordCallback) { WSPasswordCallback cb = (WSPasswordCallback) call; - cb.setPassword(CredentialCache.getInstance().getUserPassword( + cb.setPassword(credentialCache.getUserPassword( ((WSPasswordCallback) call).getIdentifier())); } } } + + /** + * @param credentialCache the credentialCache to set + */ + public void setCredentialCache(CredentialCache credentialCache) { + this.credentialCache = credentialCache; + } + + } diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/web/security/CredentialCache.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/web/security/CredentialCache.java index 2b1f469b53..66db1cdad9 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/web/security/CredentialCache.java +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/web/security/CredentialCache.java @@ -60,6 +60,7 @@ import com.raytheon.uf.edex.security.SecurityConfiguration; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * 7/10/2014 1717 bphillip Initial creation + * 7/24/2014 1712 bphillip No longer singleton * * * @author bphillip @@ -67,9 +68,6 @@ import com.raytheon.uf.edex.security.SecurityConfiguration; **/ public class CredentialCache { - /** The singleton instance */ - private static CredentialCache instance = new CredentialCache(); - /** The registry REST services */ private RegistryRESTServices restServices; @@ -175,15 +173,6 @@ public class CredentialCache { } - /** - * Gets the singleton instance of the Credential cache - * - * @return The singleton instance - */ - public static CredentialCache getInstance() { - return instance; - } - /** * Listens for updates to users and invalidates their entries in the cache * if they have changed diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/web/security/RegistryLoginModule.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/web/security/RegistryLoginModule.java index e86bf95290..dbd6cc2d9c 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/web/security/RegistryLoginModule.java +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/web/security/RegistryLoginModule.java @@ -30,10 +30,12 @@ import org.eclipse.jetty.util.security.Credential; import org.eclipse.jetty.util.security.Password; import com.raytheon.uf.common.registry.services.RegistryServiceException; +import com.raytheon.uf.edex.core.EDEXUtil; /** * - * The registry login module used by the Jetty server hosting the registry services + * The registry login module used by the Jetty server hosting the registry + * services * *
  * 
@@ -42,6 +44,7 @@ import com.raytheon.uf.common.registry.services.RegistryServiceException;
  * Date         Ticket#     Engineer    Description
  * ------------ ----------  ----------- --------------------------
  * 7/10/2014    1717        bphillip    Initial creation
+ * 7/24/2014    1712       bphillip    Spring injection of CredentialCache
  * 
* * @author bphillip @@ -49,24 +52,33 @@ import com.raytheon.uf.common.registry.services.RegistryServiceException; **/ public class RegistryLoginModule extends AbstractLoginModule { + /** Cache of user credentials */ + private CredentialCache credentialCache; + /** * Creates a new RegistryLoginModule */ public RegistryLoginModule() { super(); + /* + * This class is instantiated via reflection by the Jetty server. Therefore + * direct spring injection is not possible + */ + this.credentialCache = (CredentialCache) EDEXUtil + .getESBComponent("credentialCache"); } @Override - public UserInfo getUserInfo(final String userName) { + public UserInfo getUserInfo(final String userName) { String[] user = null; try { - user = CredentialCache.getInstance().getUser(userName); + user = credentialCache.getUser(userName); } catch (RegistryServiceException e) { throw new WebServiceException("User [" + userName - + " Not authorized!",e); + + " Not authorized!", e); } - for(String userField:user){ - if(userField == null){ + for (String userField : user) { + if (userField == null) { throw new WebServiceException("User [" + userName + " Not authorized!"); } diff --git a/edexOsgi/com.raytheon.uf.edex.security/res/spring/edex-security.xml b/edexOsgi/com.raytheon.uf.edex.security/res/spring/edex-security.xml index a4f8dbd60d..2dd356a885 100644 --- a/edexOsgi/com.raytheon.uf.edex.security/res/spring/edex-security.xml +++ b/edexOsgi/com.raytheon.uf.edex.security/res/spring/edex-security.xml @@ -4,6 +4,8 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd"> + +