From 9ecac0dc0810a3cabf8eb75951f1b7a3c149ae94 Mon Sep 17 00:00:00 2001 From: Mathieu Baudier Date: Wed, 16 Feb 2011 13:55:52 +0000 Subject: [PATCH] Improve packaging (esp. security) git-svn-id: https://svn.argeo.org/commons/trunk@4149 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- .../org.argeo.eclipse.dep.common/pom.xml | 2 +- .../org.argeo.eclipse.dep.rap/pom.xml | 2 +- .../org.argeo.eclipse.dep.rcp/pom.xml | 2 +- eclipse/plugins/org.argeo.eclipse.ui/pom.xml | 2 +- pom.xml | 4 +- .../org.argeo.security.equinox/.classpath | 1 - .../build.properties | 3 +- .../org.argeo.security.equinox/pom.xml | 21 +-- .../security/equinox/SpringLoginModule.java | 127 +++++++++--------- .../META-INF}/jaas_default.txt | 0 .../SecureRCP.product | 3 +- .../org.argeo.security.ui.application/pom.xml | 78 ++++++----- .../AbstractSecureApplication.java | 22 +-- .../SecureApplicationActivator.java} | 9 +- .../plugins/org.argeo.security.ui.rap/pom.xml | 54 +++++++- .../plugins/org.argeo.security.ui/pom.xml | 37 +++-- .../org/argeo/security/ui}/CurrentUser.java | 35 +---- .../security/ui/SecurityPerspective.java | 1 - .../security/ui/views/CurrentUserView.java | 66 ++++----- .../argeo/security/ui/views/UsersView.java | 2 +- security/eclipse/plugins/pom.xml | 5 + .../org.argeo.security.activemq/.classpath | 7 + .../org.argeo.security.activemq/.project | 28 ++++ .../.settings/org.eclipse.jdt.core.prefs | 8 ++ .../.settings/org.eclipse.pde.core.prefs | 4 + .../build.properties | 4 + .../org.argeo.security.activemq/pom.xml | 89 ++++++++++++ .../ActiveMqSecurityBrokerPlugin.java | 0 .../ActiveMqSpringSecurityContext.java | 0 .../SecuredActiveMqConnectionFactory.java | 5 +- .../activemq}/UserPasswordDialog.java | 2 +- .../org.argeo.security.core/build.properties | 3 +- .../runtime/org.argeo.security.core/pom.xml | 86 +++--------- .../org.argeo.security.ldap/.classpath | 7 + .../runtime/org.argeo.security.ldap/.project | 28 ++++ .../.settings/org.eclipse.jdt.core.prefs | 8 ++ .../.settings/org.eclipse.pde.core.prefs | 4 + .../org.argeo.security.ldap/build.properties | 4 + .../runtime/org.argeo.security.ldap/pom.xml | 69 ++++++++++ .../security/ldap/ArgeoSecurityDaoLdap.java | 1 - .../ldap/ArgeoUserDetailsContextMapper.java | 0 .../argeo/security/ldap/UserNatureMapper.java | 0 .../ldap/nature/CoworkerUserNatureMapper.java | 0 .../ldap/nature/SimpleUserNatureMapper.java | 0 security/runtime/pom.xml | 2 + .../pom.xml | 16 ++- .../dep/org.argeo.server.dep.tomcat/pom.xml | 34 +---- server/runtime/org.argeo.server.core/pom.xml | 4 - .../org.argeo.server.jackrabbit/pom.xml | 8 +- .../jackrabbit/JackrabbitContainer.java | 20 ++- 50 files changed, 587 insertions(+), 330 deletions(-) rename security/eclipse/plugins/{org.argeo.security.equinox/src/main/resources/org/argeo/security/equinox => org.argeo.security.ui.application/META-INF}/jaas_default.txt (100%) rename security/eclipse/plugins/{org.argeo.security.equinox/src/main/java/org/argeo/security/equinox/EquinoxSecurity.java => org.argeo.security.ui.application/src/main/java/org/argeo/security/ui/application/SecureApplicationActivator.java} (76%) rename security/eclipse/plugins/{org.argeo.security.equinox/src/main/java/org/argeo/security/equinox => org.argeo.security.ui/src/main/java/org/argeo/security/ui}/CurrentUser.java (55%) create mode 100644 security/runtime/org.argeo.security.activemq/.classpath create mode 100644 security/runtime/org.argeo.security.activemq/.project create mode 100644 security/runtime/org.argeo.security.activemq/.settings/org.eclipse.jdt.core.prefs create mode 100644 security/runtime/org.argeo.security.activemq/.settings/org.eclipse.pde.core.prefs create mode 100644 security/runtime/org.argeo.security.activemq/build.properties create mode 100644 security/runtime/org.argeo.security.activemq/pom.xml rename security/runtime/{org.argeo.security.core => org.argeo.security.activemq}/src/main/java/org/argeo/security/activemq/ActiveMqSecurityBrokerPlugin.java (100%) rename security/runtime/{org.argeo.security.core => org.argeo.security.activemq}/src/main/java/org/argeo/security/activemq/ActiveMqSpringSecurityContext.java (100%) rename security/runtime/{org.argeo.security.core => org.argeo.security.activemq}/src/main/java/org/argeo/security/activemq/SecuredActiveMqConnectionFactory.java (97%) rename security/runtime/{org.argeo.security.core/src/main/java/org/argeo/security/core => org.argeo.security.activemq/src/main/java/org/argeo/security/activemq}/UserPasswordDialog.java (98%) create mode 100644 security/runtime/org.argeo.security.ldap/.classpath create mode 100644 security/runtime/org.argeo.security.ldap/.project create mode 100644 security/runtime/org.argeo.security.ldap/.settings/org.eclipse.jdt.core.prefs create mode 100644 security/runtime/org.argeo.security.ldap/.settings/org.eclipse.pde.core.prefs create mode 100644 security/runtime/org.argeo.security.ldap/build.properties create mode 100644 security/runtime/org.argeo.security.ldap/pom.xml rename security/runtime/{org.argeo.security.core => org.argeo.security.ldap}/src/main/java/org/argeo/security/ldap/ArgeoSecurityDaoLdap.java (99%) rename security/runtime/{org.argeo.security.core => org.argeo.security.ldap}/src/main/java/org/argeo/security/ldap/ArgeoUserDetailsContextMapper.java (100%) rename security/runtime/{org.argeo.security.core => org.argeo.security.ldap}/src/main/java/org/argeo/security/ldap/UserNatureMapper.java (100%) rename security/runtime/{org.argeo.security.core => org.argeo.security.ldap}/src/main/java/org/argeo/security/ldap/nature/CoworkerUserNatureMapper.java (100%) rename security/runtime/{org.argeo.security.core => org.argeo.security.ldap}/src/main/java/org/argeo/security/ldap/nature/SimpleUserNatureMapper.java (100%) diff --git a/eclipse/features/org.argeo.eclipse.dep.common/pom.xml b/eclipse/features/org.argeo.eclipse.dep.common/pom.xml index 8562cf092..3bc6845e1 100644 --- a/eclipse/features/org.argeo.eclipse.dep.common/pom.xml +++ b/eclipse/features/org.argeo.eclipse.dep.common/pom.xml @@ -8,7 +8,7 @@ .. org.argeo.eclipse.dep.common - Argeo Commons RCP Dependencies + Commons Eclipse Dependencies diff --git a/eclipse/features/org.argeo.eclipse.dep.rap/pom.xml b/eclipse/features/org.argeo.eclipse.dep.rap/pom.xml index b586a8011..bbbd72407 100644 --- a/eclipse/features/org.argeo.eclipse.dep.rap/pom.xml +++ b/eclipse/features/org.argeo.eclipse.dep.rap/pom.xml @@ -8,7 +8,7 @@ .. org.argeo.eclipse.dep.rap - Argeo Commons RAP Dependencies + Commons RAP Dependencies diff --git a/eclipse/features/org.argeo.eclipse.dep.rcp/pom.xml b/eclipse/features/org.argeo.eclipse.dep.rcp/pom.xml index dbcc14f93..69c731326 100644 --- a/eclipse/features/org.argeo.eclipse.dep.rcp/pom.xml +++ b/eclipse/features/org.argeo.eclipse.dep.rcp/pom.xml @@ -8,7 +8,7 @@ .. org.argeo.eclipse.dep.rcp - Argeo Commons RCP Dependencies + Commons RCP Dependencies diff --git a/eclipse/plugins/org.argeo.eclipse.ui/pom.xml b/eclipse/plugins/org.argeo.eclipse.ui/pom.xml index acbba4ea4..6192d795c 100644 --- a/eclipse/plugins/org.argeo.eclipse.ui/pom.xml +++ b/eclipse/plugins/org.argeo.eclipse.ui/pom.xml @@ -31,7 +31,7 @@ lazy org.argeo.eclipse.ui.ArgeoUiPlugin - org.eclipse.ui;resolution:=optional,org.eclipse.rap.ui;resolution:=optional,org.eclipse.core.runtime,org.springframework.osgi.extender + org.eclipse.ui;resolution:=optional,org.eclipse.rap.ui;resolution:=optional,org.eclipse.core.runtime org.springframework.beans.factory, org.springframework.core.io.support, diff --git a/pom.xml b/pom.xml index b928bd34e..f67dfdf4c 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 0.2.3-SNAPSHOT 0.12.5 3.6.1 - 0.1.30 + 0.1.31-SNAPSHOT 2.2.0 1.1.1 file:///srv/projects/www/commons/site @@ -73,8 +73,8 @@ limitations under the License. basic osgi server - security eclipse + security sandbox diff --git a/security/eclipse/plugins/org.argeo.security.equinox/.classpath b/security/eclipse/plugins/org.argeo.security.equinox/.classpath index d3d5c8095..92f19d2ff 100644 --- a/security/eclipse/plugins/org.argeo.security.equinox/.classpath +++ b/security/eclipse/plugins/org.argeo.security.equinox/.classpath @@ -3,6 +3,5 @@ - diff --git a/security/eclipse/plugins/org.argeo.security.equinox/build.properties b/security/eclipse/plugins/org.argeo.security.equinox/build.properties index 5e565ebc8..3e2615fae 100644 --- a/security/eclipse/plugins/org.argeo.security.equinox/build.properties +++ b/security/eclipse/plugins/org.argeo.security.equinox/build.properties @@ -1,5 +1,4 @@ bin.includes = META-INF/,\ plugin.xml -source.. = src/main/java/,\ - src/main/resources/ +source.. = src/main/java/ output.. = target/classes/ diff --git a/security/eclipse/plugins/org.argeo.security.equinox/pom.xml b/security/eclipse/plugins/org.argeo.security.equinox/pom.xml index 9f662d802..944a6e0df 100644 --- a/security/eclipse/plugins/org.argeo.security.equinox/pom.xml +++ b/security/eclipse/plugins/org.argeo.security.equinox/pom.xml @@ -29,9 +29,19 @@ maven-bundle-plugin ${version.maven-bundle-plugin} + + + + + + + + + + + + - lazy - org.argeo.security.equinox.EquinoxSecurity *, org.springframework.core, org.argeo.eclipse.spring @@ -65,12 +75,5 @@ org.springframework.security org.springframework.security.core - - - - org.slf4j - com.springsource.slf4j.org.apache.commons.logging - - diff --git a/security/eclipse/plugins/org.argeo.security.equinox/src/main/java/org/argeo/security/equinox/SpringLoginModule.java b/security/eclipse/plugins/org.argeo.security.equinox/src/main/java/org/argeo/security/equinox/SpringLoginModule.java index d4361b2f6..2222faecc 100644 --- a/security/eclipse/plugins/org.argeo.security.equinox/src/main/java/org/argeo/security/equinox/SpringLoginModule.java +++ b/security/eclipse/plugins/org.argeo.security.equinox/src/main/java/org/argeo/security/equinox/SpringLoginModule.java @@ -10,8 +10,6 @@ import javax.security.auth.callback.PasswordCallback; import javax.security.auth.callback.TextOutputCallback; import javax.security.auth.login.LoginException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.springframework.security.Authentication; import org.springframework.security.AuthenticationManager; import org.springframework.security.BadCredentialsException; @@ -21,10 +19,7 @@ import org.springframework.security.providers.jaas.SecurityContextLoginModule; /** Login module which caches one subject per thread. */ public class SpringLoginModule extends SecurityContextLoginModule { - private final static Log log = LogFactory.getLog(SpringLoginModule.class); - private AuthenticationManager authenticationManager; -// private ThreadLocal subject; private CallbackHandler callbackHandler; @@ -36,7 +31,7 @@ public class SpringLoginModule extends SecurityContextLoginModule { public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options) { super.initialize(subject, callbackHandler, sharedState, options); -// this.subject.set(subject); + // this.subject.set(subject); this.callbackHandler = callbackHandler; } @@ -45,68 +40,66 @@ public class SpringLoginModule extends SecurityContextLoginModule { if (SecurityContextHolder.getContext().getAuthentication() != null) return super.login(); -// if (getSubject().getPrincipals(Authentication.class).size() == 1) { -// registerAuthentication(getSubject() -// .getPrincipals(Authentication.class).iterator().next()); -// return super.login(); -// } else if (getSubject().getPrincipals(Authentication.class).size() > 1) { -// throw new LoginException( -// "Multiple Authentication principals not supported: " -// + getSubject().getPrincipals(Authentication.class)); -// } else { - // ask for username and password - Callback label = new TextOutputCallback( - TextOutputCallback.INFORMATION, "Required login"); - NameCallback nameCallback = new NameCallback("User"); - PasswordCallback passwordCallback = new PasswordCallback( - "Password", false); - - if (callbackHandler == null) { - throw new LoginException("No call back handler available"); - // return false; - } - try { - callbackHandler.handle(new Callback[] { label, nameCallback, - passwordCallback }); - } catch (Exception e) { - LoginException le = new LoginException( - "Callback handling failed"); - le.initCause(e); - throw le; - } - - // Set user name and password - String username = nameCallback.getName(); - String password = ""; - if (passwordCallback.getPassword() != null) { - password = String.valueOf(passwordCallback.getPassword()); - } - UsernamePasswordAuthenticationToken credentials = new UsernamePasswordAuthenticationToken( - username, password); - - try { - Authentication authentication = authenticationManager - .authenticate(credentials); - registerAuthentication(authentication); - boolean res = super.login(); -// if (log.isDebugEnabled()) -// log.debug("User " + username + " logged in"); - return res; - } catch (BadCredentialsException bce) { - throw bce; - } catch (Exception e) { - LoginException loginException = new LoginException( - "Bad credentials"); - loginException.initCause(e); - throw loginException; - } -// } + // if (getSubject().getPrincipals(Authentication.class).size() == 1) { + // registerAuthentication(getSubject() + // .getPrincipals(Authentication.class).iterator().next()); + // return super.login(); + // } else if (getSubject().getPrincipals(Authentication.class).size() > + // 1) { + // throw new LoginException( + // "Multiple Authentication principals not supported: " + // + getSubject().getPrincipals(Authentication.class)); + // } else { + // ask for username and password + Callback label = new TextOutputCallback(TextOutputCallback.INFORMATION, + "Required login"); + NameCallback nameCallback = new NameCallback("User"); + PasswordCallback passwordCallback = new PasswordCallback("Password", + false); + + if (callbackHandler == null) { + throw new LoginException("No call back handler available"); + // return false; + } + try { + callbackHandler.handle(new Callback[] { label, nameCallback, + passwordCallback }); + } catch (Exception e) { + LoginException le = new LoginException("Callback handling failed"); + le.initCause(e); + throw le; + } + + // Set user name and password + String username = nameCallback.getName(); + String password = ""; + if (passwordCallback.getPassword() != null) { + password = String.valueOf(passwordCallback.getPassword()); + } + UsernamePasswordAuthenticationToken credentials = new UsernamePasswordAuthenticationToken( + username, password); + + try { + Authentication authentication = authenticationManager + .authenticate(credentials); + registerAuthentication(authentication); + boolean res = super.login(); + // if (log.isDebugEnabled()) + // log.debug("User " + username + " logged in"); + return res; + } catch (BadCredentialsException bce) { + throw bce; + } catch (Exception e) { + LoginException loginException = new LoginException( + "Bad credentials"); + loginException.initCause(e); + throw loginException; + } + // } } @Override public boolean logout() throws LoginException { - if (log.isDebugEnabled()) - log.debug("Log out "+CurrentUser.getUsername()); return super.logout(); } @@ -126,8 +119,8 @@ public class SpringLoginModule extends SecurityContextLoginModule { this.authenticationManager = authenticationManager; } -// protected Subject getSubject() { -// return subject.get(); -// } + // protected Subject getSubject() { + // return subject.get(); + // } } diff --git a/security/eclipse/plugins/org.argeo.security.equinox/src/main/resources/org/argeo/security/equinox/jaas_default.txt b/security/eclipse/plugins/org.argeo.security.ui.application/META-INF/jaas_default.txt similarity index 100% rename from security/eclipse/plugins/org.argeo.security.equinox/src/main/resources/org/argeo/security/equinox/jaas_default.txt rename to security/eclipse/plugins/org.argeo.security.ui.application/META-INF/jaas_default.txt diff --git a/security/eclipse/plugins/org.argeo.security.ui.application/SecureRCP.product b/security/eclipse/plugins/org.argeo.security.ui.application/SecureRCP.product index 50c1f3ca2..574dcc77e 100644 --- a/security/eclipse/plugins/org.argeo.security.ui.application/SecureRCP.product +++ b/security/eclipse/plugins/org.argeo.security.ui.application/SecureRCP.product @@ -35,7 +35,6 @@ - @@ -63,6 +62,7 @@ + @@ -71,6 +71,7 @@ + diff --git a/security/eclipse/plugins/org.argeo.security.ui.application/pom.xml b/security/eclipse/plugins/org.argeo.security.ui.application/pom.xml index 1fd2973a4..e86c48750 100644 --- a/security/eclipse/plugins/org.argeo.security.ui.application/pom.xml +++ b/security/eclipse/plugins/org.argeo.security.ui.application/pom.xml @@ -1,4 +1,5 @@ - + 4.0.0 org.argeo.commons.security @@ -29,6 +30,7 @@ ${version.maven-bundle-plugin} + org.argeo.security.ui.application.SecureApplicationActivator lazy org.eclipse.ui;resolution:=optional,org.eclipse.rap.ui;resolution:=optional,org.eclipse.core.runtime * @@ -74,78 +76,84 @@ org.argeo.commons.security - org.argeo.security.equinox + org.argeo.security.ui 0.2.3-SNAPSHOT org.argeo.commons.security - org.argeo.security.ui + org.argeo.security.equinox 0.2.3-SNAPSHOT + + - org.argeo.commons.server - org.argeo.server.dep.ads + org.argeo.commons.eclipse + org.argeo.eclipse.dep.rcp 0.2.3-SNAPSHOT - pom + provided + + + + + org.argeo.commons.basic + org.argeo.basic.nodeps + 0.2.3-SNAPSHOT + + + + + + org.slf4j + com.springsource.slf4j.org.apache.commons.logging + + org.argeo.commons.server org.argeo.server.ads.server ${version.argeo-commons} + test org.argeo.commons.security org.argeo.security.services ${version.argeo-commons} + test + + + org.argeo.commons.security + org.argeo.security.ldap + ${version.argeo-commons} + test org.argeo.commons.security org.argeo.security.manager.ldap ${version.argeo-commons} + test org.argeo.commons.server org.argeo.server.ads 0.2.3-SNAPSHOT + test org.argeo.dep.osgi org.argeo.dep.osgi.springframework.ldap + test - - - - org.argeo.commons.eclipse - org.argeo.eclipse.dep.rcp - 0.2.3-SNAPSHOT - - - - - org.argeo.commons.server - org.argeo.server.json - 0.2.3-SNAPSHOT - - - - - org.argeo.commons.basic - org.argeo.basic.nodeps - 0.2.3-SNAPSHOT - - - - - - org.slf4j - com.springsource.slf4j.org.apache.commons.logging - - org.argeo.commons.basic org.argeo.basic.dep.log4j 0.2.3-SNAPSHOT pom + test + + + net.sourceforge.jdbm + com.springsource.jdbm + test diff --git a/security/eclipse/plugins/org.argeo.security.ui.application/src/main/java/org/argeo/security/ui/application/AbstractSecureApplication.java b/security/eclipse/plugins/org.argeo.security.ui.application/src/main/java/org/argeo/security/ui/application/AbstractSecureApplication.java index 3a92e5273..a0a2f922b 100644 --- a/security/eclipse/plugins/org.argeo.security.ui.application/src/main/java/org/argeo/security/ui/application/AbstractSecureApplication.java +++ b/security/eclipse/plugins/org.argeo.security.ui.application/src/main/java/org/argeo/security/ui/application/AbstractSecureApplication.java @@ -6,7 +6,6 @@ import javax.security.auth.Subject; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.argeo.security.equinox.CurrentUser; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.equinox.app.IApplication; @@ -34,12 +33,18 @@ public abstract class AbstractSecureApplication implements IApplication { try { String username = null; Exception loginException = null; + Subject subject = null; try { - username = CurrentUser.getUsername(); + SecureApplicationActivator.getLoginContext().login(); + subject = SecureApplicationActivator.getLoginContext() + .getSubject(); + + // username = CurrentUser.getUsername(); } catch (Exception e) { loginException = e; + e.printStackTrace(); } - if (username == null) { + if (subject == null) { IStatus status = new Status(IStatus.ERROR, "org.argeo.security.application", "Login is mandatory", loginException); @@ -48,9 +53,8 @@ public abstract class AbstractSecureApplication implements IApplication { } if (log.isDebugEnabled()) log.debug("Logged in as " + username); - returnCode = (Integer) Subject.doAs(CurrentUser.getSubject(), - getRunAction(display)); - CurrentUser.logout(); + returnCode = (Integer) Subject.doAs(subject, getRunAction(display)); + SecureApplicationActivator.getLoginContext().logout(); return processReturnCode(returnCode); } catch (Exception e) { // e.printStackTrace(); @@ -104,9 +108,9 @@ public abstract class AbstractSecureApplication implements IApplication { if (log.isDebugEnabled()) log.debug("workbench stopped"); - String username = CurrentUser.getUsername(); - if (log.isDebugEnabled()) - log.debug("workbench stopped, logged in as " + username); + // String username = CurrentUser.getUsername(); + // if (log.isDebugEnabled()) + // log.debug("workbench stopped, logged in as " + username); } diff --git a/security/eclipse/plugins/org.argeo.security.equinox/src/main/java/org/argeo/security/equinox/EquinoxSecurity.java b/security/eclipse/plugins/org.argeo.security.ui.application/src/main/java/org/argeo/security/ui/application/SecureApplicationActivator.java similarity index 76% rename from security/eclipse/plugins/org.argeo.security.equinox/src/main/java/org/argeo/security/equinox/EquinoxSecurity.java rename to security/eclipse/plugins/org.argeo.security.ui.application/src/main/java/org/argeo/security/ui/application/SecureApplicationActivator.java index 00f9faa18..ec5d625de 100644 --- a/security/eclipse/plugins/org.argeo.security.equinox/src/main/java/org/argeo/security/equinox/EquinoxSecurity.java +++ b/security/eclipse/plugins/org.argeo.security.ui.application/src/main/java/org/argeo/security/ui/application/SecureApplicationActivator.java @@ -1,4 +1,4 @@ -package org.argeo.security.equinox; +package org.argeo.security.ui.application; import java.net.URL; @@ -7,14 +7,14 @@ import org.eclipse.equinox.security.auth.LoginContextFactory; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; -public class EquinoxSecurity implements BundleActivator { +public class SecureApplicationActivator implements BundleActivator { + public final static String CONTEXT_SPRING = "SPRING"; - private static final String JAAS_CONFIG_FILE = "org/argeo/security/equinox/jaas_default.txt"; + private static final String JAAS_CONFIG_FILE = "/META-INF/jaas_default.txt"; private static ILoginContext loginContext = null; public void start(BundleContext bundleContext) throws Exception { - // getLoginContext(); URL configUrl = bundleContext.getBundle().getEntry(JAAS_CONFIG_FILE); loginContext = LoginContextFactory.createContext(CONTEXT_SPRING, configUrl); @@ -26,5 +26,4 @@ public class EquinoxSecurity implements BundleActivator { static ILoginContext getLoginContext() { return loginContext; } - } diff --git a/security/eclipse/plugins/org.argeo.security.ui.rap/pom.xml b/security/eclipse/plugins/org.argeo.security.ui.rap/pom.xml index 92151771f..764c63f1c 100644 --- a/security/eclipse/plugins/org.argeo.security.ui.rap/pom.xml +++ b/security/eclipse/plugins/org.argeo.security.ui.rap/pom.xml @@ -1,4 +1,5 @@ - + 4.0.0 org.argeo.commons.security @@ -76,5 +77,56 @@ org.argeo.eclipse.dep.rap 0.2.3-SNAPSHOT + + + + + + org.argeo.commons.server + org.argeo.server.ads.server + ${version.argeo-commons} + test + + + org.argeo.commons.security + org.argeo.security.services + ${version.argeo-commons} + test + + + org.argeo.commons.security + org.argeo.security.ldap + ${version.argeo-commons} + test + + + org.argeo.commons.security + org.argeo.security.manager.ldap + ${version.argeo-commons} + test + + + org.argeo.commons.server + org.argeo.server.ads + 0.2.3-SNAPSHOT + test + + + org.argeo.dep.osgi + org.argeo.dep.osgi.springframework.ldap + test + + + org.argeo.commons.basic + org.argeo.basic.dep.log4j + 0.2.3-SNAPSHOT + pom + test + + + net.sourceforge.jdbm + com.springsource.jdbm + test + diff --git a/security/eclipse/plugins/org.argeo.security.ui/pom.xml b/security/eclipse/plugins/org.argeo.security.ui/pom.xml index f4fb717d4..0d9ed3165 100644 --- a/security/eclipse/plugins/org.argeo.security.ui/pom.xml +++ b/security/eclipse/plugins/org.argeo.security.ui/pom.xml @@ -1,4 +1,5 @@ - + 4.0.0 org.argeo.commons.security @@ -28,11 +29,33 @@ maven-bundle-plugin ${version.maven-bundle-plugin} + + + + + + + + + + + + + + + + + + + lazy org.argeo.security.ui.SecurityUiPlugin org.eclipse.ui;resolution:=optional,org.eclipse.rap.ui;resolution:=optional,org.eclipse.core.runtime - *,org.argeo.eclipse.spring + + org.argeo.eclipse.spring, + * + @@ -45,11 +68,6 @@ org.argeo.security.core 0.2.3-SNAPSHOT - - org.argeo.commons.security - org.argeo.security.equinox - 0.2.3-SNAPSHOT - @@ -70,10 +88,6 @@ org.argeo.commons.eclipse org.argeo.eclipse.dep.rcp 0.2.3-SNAPSHOT - - - org.eclipse.ui - org.eclipse.ui provided @@ -95,6 +109,5 @@ org.slf4j com.springsource.slf4j.org.apache.commons.logging - diff --git a/security/eclipse/plugins/org.argeo.security.equinox/src/main/java/org/argeo/security/equinox/CurrentUser.java b/security/eclipse/plugins/org.argeo.security.ui/src/main/java/org/argeo/security/ui/CurrentUser.java similarity index 55% rename from security/eclipse/plugins/org.argeo.security.equinox/src/main/java/org/argeo/security/equinox/CurrentUser.java rename to security/eclipse/plugins/org.argeo.security.ui/src/main/java/org/argeo/security/ui/CurrentUser.java index 12cda5371..a864c3a10 100644 --- a/security/eclipse/plugins/org.argeo.security.equinox/src/main/java/org/argeo/security/equinox/CurrentUser.java +++ b/security/eclipse/plugins/org.argeo.security.ui/src/main/java/org/argeo/security/ui/CurrentUser.java @@ -1,4 +1,4 @@ -package org.argeo.security.equinox; +package org.argeo.security.ui; import java.security.AccessController; import java.security.Principal; @@ -7,10 +7,8 @@ import java.util.HashSet; import java.util.Set; import javax.security.auth.Subject; -import javax.security.auth.login.LoginException; import org.argeo.ArgeoException; -import org.eclipse.equinox.security.auth.ILoginContext; import org.springframework.security.Authentication; import org.springframework.security.GrantedAuthority; @@ -34,41 +32,12 @@ public class CurrentUser { return Collections.unmodifiableSet(roles); } - private final static ILoginContext getLoginContext() { - return EquinoxSecurity.getLoginContext(); - // return LoginContextFactory - // .createContext(EquinoxSecurity.CONTEXT_SPRING); - } - - // private static void login() { - // try { - // getLoginContext().login(); - // } catch (LoginException e) { - // throw new RuntimeException("Cannot login", e); - // } - // } - public final static Subject getSubject() { Subject subject = Subject.getSubject(AccessController.getContext()); - // subject = Subject.getSubject(AccessController.getContext()); if (subject == null) - try { - getLoginContext().login(); - subject = getLoginContext().getSubject(); - } catch (Exception e) { - throw new ArgeoException("Cannot retrieve subject", e); - } - + throw new ArgeoException("Not authenticated."); return subject; } - - public static void logout() { - try { - getLoginContext().logout(); - } catch (LoginException e) { - throw new ArgeoException("Cannot log out", e); - } - } } diff --git a/security/eclipse/plugins/org.argeo.security.ui/src/main/java/org/argeo/security/ui/SecurityPerspective.java b/security/eclipse/plugins/org.argeo.security.ui/src/main/java/org/argeo/security/ui/SecurityPerspective.java index 9187c7830..3b3b9b840 100644 --- a/security/eclipse/plugins/org.argeo.security.ui/src/main/java/org/argeo/security/ui/SecurityPerspective.java +++ b/security/eclipse/plugins/org.argeo.security.ui/src/main/java/org/argeo/security/ui/SecurityPerspective.java @@ -1,6 +1,5 @@ package org.argeo.security.ui; -import org.argeo.security.equinox.CurrentUser; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.IFolderLayout; diff --git a/security/eclipse/plugins/org.argeo.security.ui/src/main/java/org/argeo/security/ui/views/CurrentUserView.java b/security/eclipse/plugins/org.argeo.security.ui/src/main/java/org/argeo/security/ui/views/CurrentUserView.java index 263a722e7..5b0492828 100644 --- a/security/eclipse/plugins/org.argeo.security.ui/src/main/java/org/argeo/security/ui/views/CurrentUserView.java +++ b/security/eclipse/plugins/org.argeo.security.ui/src/main/java/org/argeo/security/ui/views/CurrentUserView.java @@ -1,6 +1,6 @@ package org.argeo.security.ui.views; -import org.argeo.security.equinox.CurrentUser; +import org.argeo.security.ui.CurrentUser; import org.eclipse.jface.viewers.IStructuredContentProvider; import org.eclipse.jface.viewers.ITableLabelProvider; import org.eclipse.jface.viewers.LabelProvider; @@ -46,9 +46,9 @@ public class CurrentUserView extends ViewPart { column.setText("ID"); column.setWidth(100); -// column = new TableColumn(table, SWT.LEFT, 1); -// column.setText("Password"); -// column.setWidth(200); + // column = new TableColumn(table, SWT.LEFT, 1); + // column.setText("Password"); + // column.setWidth(200); // column = new TableColumn(table, SWT.LEFT, 2); // column.setText("Roles"); @@ -69,26 +69,26 @@ public class CurrentUserView extends ViewPart { } public Object[] getChildren(Object parentElement) { -// ILoginContext secureContext = LoginContextFactory -// .createContext("SPRING"); -// try { -// secureContext.login(); -// } catch (LoginException e) { -// // login failed -// } -// -// Subject subject = null; -// // subject = Subject.getSubject(AccessController.getContext()); -// try { -// subject = secureContext.getSubject(); -// } catch (Exception e) { -// e.printStackTrace(); -// throw new ArgeoException("Cannot retrieve subject", e); -// } -// -// if (subject == null) -// throw new ArgeoException("No subject found"); -// return subject.getPrincipals().toArray(); + // ILoginContext secureContext = LoginContextFactory + // .createContext("SPRING"); + // try { + // secureContext.login(); + // } catch (LoginException e) { + // // login failed + // } + // + // Subject subject = null; + // // subject = Subject.getSubject(AccessController.getContext()); + // try { + // subject = secureContext.getSubject(); + // } catch (Exception e) { + // e.printStackTrace(); + // throw new ArgeoException("Cannot retrieve subject", e); + // } + // + // if (subject == null) + // throw new ArgeoException("No subject found"); + // return subject.getPrincipals().toArray(); return CurrentUser.roles().toArray(); } @@ -107,15 +107,15 @@ public class CurrentUserView extends ViewPart { private class UsersLabelProvider extends LabelProvider implements ITableLabelProvider { public String getColumnText(Object element, int columnIndex) { -// Principal argeoUser = (Principal) element; -// switch (columnIndex) { -// case 0: -// return argeoUser.getName(); -// case 1: -// return argeoUser.toString(); -// default: -// throw new ArgeoException("Unmanaged column " + columnIndex); -// } + // Principal argeoUser = (Principal) element; + // switch (columnIndex) { + // case 0: + // return argeoUser.getName(); + // case 1: + // return argeoUser.toString(); + // default: + // throw new ArgeoException("Unmanaged column " + columnIndex); + // } return element.toString(); } diff --git a/security/eclipse/plugins/org.argeo.security.ui/src/main/java/org/argeo/security/ui/views/UsersView.java b/security/eclipse/plugins/org.argeo.security.ui/src/main/java/org/argeo/security/ui/views/UsersView.java index d77ad0e07..5d7817827 100644 --- a/security/eclipse/plugins/org.argeo.security.ui/src/main/java/org/argeo/security/ui/views/UsersView.java +++ b/security/eclipse/plugins/org.argeo.security.ui/src/main/java/org/argeo/security/ui/views/UsersView.java @@ -5,8 +5,8 @@ import java.util.ArrayList; import org.argeo.ArgeoException; import org.argeo.security.ArgeoSecurityService; import org.argeo.security.ArgeoUser; -import org.argeo.security.equinox.CurrentUser; import org.argeo.security.nature.SimpleUserNature; +import org.argeo.security.ui.CurrentUser; import org.argeo.security.ui.SecurityUiPlugin; import org.argeo.security.ui.commands.OpenArgeoUserEditor; import org.eclipse.core.commands.Command; diff --git a/security/eclipse/plugins/pom.xml b/security/eclipse/plugins/pom.xml index e953b71a8..ab837feb5 100644 --- a/security/eclipse/plugins/pom.xml +++ b/security/eclipse/plugins/pom.xml @@ -80,5 +80,10 @@ 0.2.3-SNAPSHOT test + + javax.xml.stream + com.springsource.javax.xml.stream + test + diff --git a/security/runtime/org.argeo.security.activemq/.classpath b/security/runtime/org.argeo.security.activemq/.classpath new file mode 100644 index 000000000..92f19d2ff --- /dev/null +++ b/security/runtime/org.argeo.security.activemq/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/security/runtime/org.argeo.security.activemq/.project b/security/runtime/org.argeo.security.activemq/.project new file mode 100644 index 000000000..cdc841c57 --- /dev/null +++ b/security/runtime/org.argeo.security.activemq/.project @@ -0,0 +1,28 @@ + + + org.argeo.security.activemq + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/security/runtime/org.argeo.security.activemq/.settings/org.eclipse.jdt.core.prefs b/security/runtime/org.argeo.security.activemq/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..312bbe193 --- /dev/null +++ b/security/runtime/org.argeo.security.activemq/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Wed Feb 16 10:40:27 CET 2011 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/security/runtime/org.argeo.security.activemq/.settings/org.eclipse.pde.core.prefs b/security/runtime/org.argeo.security.activemq/.settings/org.eclipse.pde.core.prefs new file mode 100644 index 000000000..85f20081b --- /dev/null +++ b/security/runtime/org.argeo.security.activemq/.settings/org.eclipse.pde.core.prefs @@ -0,0 +1,4 @@ +#Wed Feb 16 10:40:27 CET 2011 +eclipse.preferences.version=1 +pluginProject.extensions=false +resolve.requirebundle=false diff --git a/security/runtime/org.argeo.security.activemq/build.properties b/security/runtime/org.argeo.security.activemq/build.properties new file mode 100644 index 000000000..5fc538bc8 --- /dev/null +++ b/security/runtime/org.argeo.security.activemq/build.properties @@ -0,0 +1,4 @@ +source.. = src/main/java/ +output.. = target/classes/ +bin.includes = META-INF/,\ + . diff --git a/security/runtime/org.argeo.security.activemq/pom.xml b/security/runtime/org.argeo.security.activemq/pom.xml new file mode 100644 index 000000000..0405a5c05 --- /dev/null +++ b/security/runtime/org.argeo.security.activemq/pom.xml @@ -0,0 +1,89 @@ + + 4.0.0 + + org.argeo.commons.security + runtime + 0.2.3-SNAPSHOT + .. + + org.argeo.security.activemq + Commons Security ActiveMQ + + + + org.apache.maven.plugins + maven-compiler-plugin + + + org.apache.maven.plugins + maven-source-plugin + + + org.apache.maven.plugins + maven-jar-plugin + + + org.apache.felix + maven-bundle-plugin + ${version.maven-bundle-plugin} + + + + org.argeo.security.activemq.* + + + + + + + + + org.argeo.commons.basic + org.argeo.basic.nodeps + 0.2.3-SNAPSHOT + + + org.argeo.commons.security + org.argeo.security.core + 0.2.3-SNAPSHOT + + + + + org.springframework + org.springframework.transaction + + + org.springframework.security + org.springframework.security.core + + + + + org.slf4j + com.springsource.slf4j.org.apache.commons.logging + + + + + org.argeo.dep.osgi + org.argeo.dep.osgi.activemq + + + javax.jms + com.springsource.javax.jms + + + org.springframework + org.springframework.jms + + + + + org.junit + com.springsource.junit + test + + + diff --git a/security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/activemq/ActiveMqSecurityBrokerPlugin.java b/security/runtime/org.argeo.security.activemq/src/main/java/org/argeo/security/activemq/ActiveMqSecurityBrokerPlugin.java similarity index 100% rename from security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/activemq/ActiveMqSecurityBrokerPlugin.java rename to security/runtime/org.argeo.security.activemq/src/main/java/org/argeo/security/activemq/ActiveMqSecurityBrokerPlugin.java diff --git a/security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/activemq/ActiveMqSpringSecurityContext.java b/security/runtime/org.argeo.security.activemq/src/main/java/org/argeo/security/activemq/ActiveMqSpringSecurityContext.java similarity index 100% rename from security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/activemq/ActiveMqSpringSecurityContext.java rename to security/runtime/org.argeo.security.activemq/src/main/java/org/argeo/security/activemq/ActiveMqSpringSecurityContext.java diff --git a/security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/activemq/SecuredActiveMqConnectionFactory.java b/security/runtime/org.argeo.security.activemq/src/main/java/org/argeo/security/activemq/SecuredActiveMqConnectionFactory.java similarity index 97% rename from security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/activemq/SecuredActiveMqConnectionFactory.java rename to security/runtime/org.argeo.security.activemq/src/main/java/org/argeo/security/activemq/SecuredActiveMqConnectionFactory.java index 95e6a6945..4afbd1d8d 100644 --- a/security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/activemq/SecuredActiveMqConnectionFactory.java +++ b/security/runtime/org.argeo.security.activemq/src/main/java/org/argeo/security/activemq/SecuredActiveMqConnectionFactory.java @@ -33,7 +33,6 @@ import org.apache.activemq.ActiveMQSslConnectionFactory; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.argeo.ArgeoException; -import org.argeo.security.core.UserPasswordDialog; import org.springframework.beans.factory.DisposableBean; import org.springframework.beans.factory.InitializingBean; import org.springframework.core.io.Resource; @@ -198,8 +197,8 @@ public class SecuredActiveMqConnectionFactory implements ConnectionFactory, .getInstance(KeyManagerFactory.getDefaultAlgorithm()); keyManagerFactory.init(keyStoreKs, keyStorePassword.toCharArray()); - connectionFactory.setKeyAndTrustManagers(keyManagerFactory - .getKeyManagers(), tmf.getTrustManagers(), + connectionFactory.setKeyAndTrustManagers( + keyManagerFactory.getKeyManagers(), tmf.getTrustManagers(), new SecureRandom()); } catch (Exception e) { throw new ArgeoException( diff --git a/security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/core/UserPasswordDialog.java b/security/runtime/org.argeo.security.activemq/src/main/java/org/argeo/security/activemq/UserPasswordDialog.java similarity index 98% rename from security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/core/UserPasswordDialog.java rename to security/runtime/org.argeo.security.activemq/src/main/java/org/argeo/security/activemq/UserPasswordDialog.java index 7e76f8746..672507662 100644 --- a/security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/core/UserPasswordDialog.java +++ b/security/runtime/org.argeo.security.activemq/src/main/java/org/argeo/security/activemq/UserPasswordDialog.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.argeo.security.core; +package org.argeo.security.activemq; import java.awt.Container; import java.awt.GridLayout; diff --git a/security/runtime/org.argeo.security.core/build.properties b/security/runtime/org.argeo.security.core/build.properties index a7129a37c..6ebf8f32f 100644 --- a/security/runtime/org.argeo.security.core/build.properties +++ b/security/runtime/org.argeo.security.core/build.properties @@ -9,7 +9,8 @@ additional.bundles = org.springframework.transaction,\ com.springsource.org.codehaus.jackson.mapper,\ com.springsource.org.apache.log4j,\ com.springsource.slf4j.api,\ - com.springsource.slf4j.org.apache.commons.logging + com.springsource.slf4j.org.apache.commons.logging,\ + org.argeo.server.json source.. = src/main/java/,\ src/main/resources/,\ src/test/java/,\ diff --git a/security/runtime/org.argeo.security.core/pom.xml b/security/runtime/org.argeo.security.core/pom.xml index b3b53e321..b36f10d56 100644 --- a/security/runtime/org.argeo.security.core/pom.xml +++ b/security/runtime/org.argeo.security.core/pom.xml @@ -1,4 +1,5 @@ - + 4.0.0 org.argeo.commons.security @@ -31,17 +32,10 @@ org.argeo.security.* - *, + org.springframework.context, - org.argeo.server.json;resolution:=optional, - javax.jms;resolution:=optional, - org.apache.activemq;resolution:=optional, - org.apache.activemq.broker;resolution:=optional, - org.apache.activemq.command;resolution:=optional, - org.apache.activemq.security;resolution:=optional, - org.springframework.jms.connection;resolution:=optional, - org.springframework.ldap.core;resolution:=optional, - org.springframework.ldap.core.support;resolution:=optional, + org.springframework.beans.factory, + * @@ -55,21 +49,14 @@ 0.2.3-SNAPSHOT - - - org.apache.commons - com.springsource.org.apache.commons.lang - - - org.argeo.dep.osgi - org.argeo.dep.osgi.springframework.ldap + org.springframework + org.springframework.beans org.springframework - org.springframework.transaction + org.springframework.context org.springframework.security @@ -81,51 +68,6 @@ org.slf4j com.springsource.slf4j.org.apache.commons.logging - - org.apache.log4j - com.springsource.org.apache.log4j - - - org.slf4j - com.springsource.slf4j.log4j - - - - - org.codehaus.jackson - com.springsource.org.codehaus.jackson.mapper - - - - com.springsource.json - com.springsource.json - - - org.antlr - com.springsource.org.antlr - - - - - org.argeo.dep.osgi - org.argeo.dep.osgi.activemq - true - - - javax.jms - com.springsource.javax.jms - true - - - org.springframework - org.springframework.jms - true - - - - - - @@ -133,12 +75,24 @@ com.springsource.junit test + + org.argeo.commons.basic + org.argeo.basic.dep.log4j + 0.2.3-SNAPSHOT + pom + test + org.argeo.commons.server org.argeo.server.json 0.2.3-SNAPSHOT test + + com.springsource.json + com.springsource.json + test + diff --git a/security/runtime/org.argeo.security.ldap/.classpath b/security/runtime/org.argeo.security.ldap/.classpath new file mode 100644 index 000000000..92f19d2ff --- /dev/null +++ b/security/runtime/org.argeo.security.ldap/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/security/runtime/org.argeo.security.ldap/.project b/security/runtime/org.argeo.security.ldap/.project new file mode 100644 index 000000000..942f1404d --- /dev/null +++ b/security/runtime/org.argeo.security.ldap/.project @@ -0,0 +1,28 @@ + + + org.argeo.security.ldap + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/security/runtime/org.argeo.security.ldap/.settings/org.eclipse.jdt.core.prefs b/security/runtime/org.argeo.security.ldap/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..740ac21b8 --- /dev/null +++ b/security/runtime/org.argeo.security.ldap/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Wed Feb 16 11:23:43 CET 2011 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/security/runtime/org.argeo.security.ldap/.settings/org.eclipse.pde.core.prefs b/security/runtime/org.argeo.security.ldap/.settings/org.eclipse.pde.core.prefs new file mode 100644 index 000000000..f09f0de0f --- /dev/null +++ b/security/runtime/org.argeo.security.ldap/.settings/org.eclipse.pde.core.prefs @@ -0,0 +1,4 @@ +#Wed Feb 16 11:23:43 CET 2011 +eclipse.preferences.version=1 +pluginProject.extensions=false +resolve.requirebundle=false diff --git a/security/runtime/org.argeo.security.ldap/build.properties b/security/runtime/org.argeo.security.ldap/build.properties new file mode 100644 index 000000000..5fc538bc8 --- /dev/null +++ b/security/runtime/org.argeo.security.ldap/build.properties @@ -0,0 +1,4 @@ +source.. = src/main/java/ +output.. = target/classes/ +bin.includes = META-INF/,\ + . diff --git a/security/runtime/org.argeo.security.ldap/pom.xml b/security/runtime/org.argeo.security.ldap/pom.xml new file mode 100644 index 000000000..9c222e9be --- /dev/null +++ b/security/runtime/org.argeo.security.ldap/pom.xml @@ -0,0 +1,69 @@ + + 4.0.0 + + org.argeo.commons.security + runtime + 0.2.3-SNAPSHOT + .. + + org.argeo.security.ldap + Commons Security LDAP + + + + org.apache.maven.plugins + maven-compiler-plugin + + + org.apache.maven.plugins + maven-source-plugin + + + org.apache.maven.plugins + maven-jar-plugin + + + org.apache.felix + maven-bundle-plugin + ${version.maven-bundle-plugin} + + + + org.argeo.security.ldap.* + + + org.springframework.core, + org.springframework.dao, + * + + + + + + + + + org.argeo.commons.basic + org.argeo.basic.nodeps + 0.2.3-SNAPSHOT + + + org.argeo.commons.security + org.argeo.security.core + 0.2.3-SNAPSHOT + + + + + org.argeo.dep.osgi + org.argeo.dep.osgi.springframework.ldap + + + + + org.slf4j + com.springsource.slf4j.org.apache.commons.logging + + + + diff --git a/security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/ldap/ArgeoSecurityDaoLdap.java b/security/runtime/org.argeo.security.ldap/src/main/java/org/argeo/security/ldap/ArgeoSecurityDaoLdap.java similarity index 99% rename from security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/ldap/ArgeoSecurityDaoLdap.java rename to security/runtime/org.argeo.security.ldap/src/main/java/org/argeo/security/ldap/ArgeoSecurityDaoLdap.java index bf4beb0e8..838a3cb97 100644 --- a/security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/ldap/ArgeoSecurityDaoLdap.java +++ b/security/runtime/org.argeo.security.ldap/src/main/java/org/argeo/security/ldap/ArgeoSecurityDaoLdap.java @@ -260,7 +260,6 @@ public class ArgeoSecurityDaoLdap implements ArgeoSecurityDao, InitializingBean public String encodePassword(String raw) { byte[] salt = null; - // TODO: check that Linux auth supports SSHA // byte[] salt = new byte[16]; // random.nextBytes(salt); return ldapShaPasswordEncoder.encodePassword(raw, salt); diff --git a/security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/ldap/ArgeoUserDetailsContextMapper.java b/security/runtime/org.argeo.security.ldap/src/main/java/org/argeo/security/ldap/ArgeoUserDetailsContextMapper.java similarity index 100% rename from security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/ldap/ArgeoUserDetailsContextMapper.java rename to security/runtime/org.argeo.security.ldap/src/main/java/org/argeo/security/ldap/ArgeoUserDetailsContextMapper.java diff --git a/security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/ldap/UserNatureMapper.java b/security/runtime/org.argeo.security.ldap/src/main/java/org/argeo/security/ldap/UserNatureMapper.java similarity index 100% rename from security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/ldap/UserNatureMapper.java rename to security/runtime/org.argeo.security.ldap/src/main/java/org/argeo/security/ldap/UserNatureMapper.java diff --git a/security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/ldap/nature/CoworkerUserNatureMapper.java b/security/runtime/org.argeo.security.ldap/src/main/java/org/argeo/security/ldap/nature/CoworkerUserNatureMapper.java similarity index 100% rename from security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/ldap/nature/CoworkerUserNatureMapper.java rename to security/runtime/org.argeo.security.ldap/src/main/java/org/argeo/security/ldap/nature/CoworkerUserNatureMapper.java diff --git a/security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/ldap/nature/SimpleUserNatureMapper.java b/security/runtime/org.argeo.security.ldap/src/main/java/org/argeo/security/ldap/nature/SimpleUserNatureMapper.java similarity index 100% rename from security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/ldap/nature/SimpleUserNatureMapper.java rename to security/runtime/org.argeo.security.ldap/src/main/java/org/argeo/security/ldap/nature/SimpleUserNatureMapper.java diff --git a/security/runtime/pom.xml b/security/runtime/pom.xml index 0265ea32f..23e8ddd4f 100644 --- a/security/runtime/pom.xml +++ b/security/runtime/pom.xml @@ -14,6 +14,8 @@ org.argeo.security.core org.argeo.security.mvc + org.argeo.security.ldap + org.argeo.security.activemq diff --git a/server/dep/org.argeo.server.dep.jackrabbit.server/pom.xml b/server/dep/org.argeo.server.dep.jackrabbit.server/pom.xml index 3d48c8e17..84338825a 100644 --- a/server/dep/org.argeo.server.dep.jackrabbit.server/pom.xml +++ b/server/dep/org.argeo.server.dep.jackrabbit.server/pom.xml @@ -170,10 +170,6 @@ org.dom4j com.springsource.org.dom4j - - javax.xml.stream - com.springsource.javax.xml.stream - org.jdom com.springsource.org.jdom @@ -195,11 +191,23 @@ com.springsource.org.xmlpull + org.argeo.commons.osgi org.argeo.osgi.boot 0.2.3-SNAPSHOT test + + javax.xml.stream + com.springsource.javax.xml.stream + test + + + org.apache.xmlcommons + com.springsource.org.apache.xmlcommons + test + + \ No newline at end of file diff --git a/server/dep/org.argeo.server.dep.tomcat/pom.xml b/server/dep/org.argeo.server.dep.tomcat/pom.xml index 58369e6e3..535ef108b 100644 --- a/server/dep/org.argeo.server.dep.tomcat/pom.xml +++ b/server/dep/org.argeo.server.dep.tomcat/pom.xml @@ -1,4 +1,5 @@ - + 4.0.0 org.argeo.commons.server @@ -10,7 +11,7 @@ pom Dep Apache Tomcat - + org.argeo.commons.basic org.argeo.basic.dep.log4j @@ -27,18 +28,10 @@ javax.servlet com.springsource.javax.servlet.jsp - - javax.annotation - com.springsource.javax.annotation - javax.persistence com.springsource.javax.persistence - - javax.activation - com.springsource.javax.activation - org.apache.geronimo.specs com.springsource.javax.management.j2ee @@ -51,18 +44,6 @@ javax.xml.rpc com.springsource.javax.xml.rpc - - javax.xml.soap - com.springsource.javax.xml.soap - - - javax.transaction - com.springsource.javax.transaction - - - javax.xml.stream - com.springsource.javax.xml.stream - javax.servlet com.springsource.javax.servlet.jsp @@ -75,14 +56,6 @@ javax.el com.springsource.javax.el - - javax.xml.ws - com.springsource.javax.xml.ws - - - javax.xml.bind - com.springsource.javax.xml.bind - @@ -111,5 +84,6 @@ org.apache.el com.springsource.org.apache.el + \ No newline at end of file diff --git a/server/runtime/org.argeo.server.core/pom.xml b/server/runtime/org.argeo.server.core/pom.xml index d07d8c19e..5bf5f47a9 100644 --- a/server/runtime/org.argeo.server.core/pom.xml +++ b/server/runtime/org.argeo.server.core/pom.xml @@ -65,10 +65,6 @@ javax.servlet com.springsource.javax.servlet - - javax.xml.stream - com.springsource.javax.xml.stream - diff --git a/server/runtime/org.argeo.server.jackrabbit/pom.xml b/server/runtime/org.argeo.server.jackrabbit/pom.xml index 8af625eec..074d07a41 100644 --- a/server/runtime/org.argeo.server.jackrabbit/pom.xml +++ b/server/runtime/org.argeo.server.jackrabbit/pom.xml @@ -1,4 +1,5 @@ - + 4.0.0 org.argeo.commons.server @@ -34,9 +35,10 @@ org.argeo.server.jcr.* - *, + org.xml.sax;version="0.0.0", org.springframework.security.providers.jaas;resolution:="optional", - junit.framework;resolution:="optional" + junit.framework;resolution:="optional", + * diff --git a/server/runtime/org.argeo.server.jackrabbit/src/main/java/org/argeo/server/jackrabbit/JackrabbitContainer.java b/server/runtime/org.argeo.server.jackrabbit/src/main/java/org/argeo/server/jackrabbit/JackrabbitContainer.java index 6bddeefd2..87738a5cd 100644 --- a/server/runtime/org.argeo.server.jackrabbit/src/main/java/org/argeo/server/jackrabbit/JackrabbitContainer.java +++ b/server/runtime/org.argeo.server.jackrabbit/src/main/java/org/argeo/server/jackrabbit/JackrabbitContainer.java @@ -24,6 +24,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Properties; import javax.jcr.Credentials; import javax.jcr.LoginException; @@ -42,12 +43,14 @@ import org.apache.jackrabbit.commons.cnd.CndImporter; import org.apache.jackrabbit.core.RepositoryImpl; import org.apache.jackrabbit.core.TransientRepository; import org.apache.jackrabbit.core.config.RepositoryConfig; +import org.apache.jackrabbit.core.config.RepositoryConfigurationParser; import org.argeo.ArgeoException; import org.springframework.beans.factory.DisposableBean; import org.springframework.beans.factory.InitializingBean; import org.springframework.context.ResourceLoaderAware; import org.springframework.core.io.Resource; import org.springframework.core.io.ResourceLoader; +import org.xml.sax.InputSource; /** * Wrapper around a Jackrabbit repository which allows to configure it in Spring @@ -59,6 +62,7 @@ public class JackrabbitContainer implements InitializingBean, DisposableBean, private Resource configuration; private File homeDirectory; + private Resource variables; private Boolean inMemory = false; @@ -89,13 +93,23 @@ public class JackrabbitContainer implements InitializingBean, DisposableBean, RepositoryConfig config; InputStream in = configuration.getInputStream(); + InputStream propsIn = null; try { - config = RepositoryConfig.create(in, + Properties vars = new Properties(); + if (variables != null) { + propsIn = variables.getInputStream(); + vars.load(propsIn); + } + // override with system properties + vars.putAll(System.getProperties()); + vars.put(RepositoryConfigurationParser.REPOSITORY_HOME_VARIABLE, homeDirectory.getCanonicalPath()); + config = RepositoryConfig.create(new InputSource(in), vars); } catch (Exception e) { throw new RuntimeException("Cannot read configuration", e); } finally { IOUtils.closeQuietly(in); + IOUtils.closeQuietly(propsIn); } if (inMemory) @@ -217,4 +231,8 @@ public class JackrabbitContainer implements InitializingBean, DisposableBean, this.cndFiles = cndFiles; } + public void setVariables(Resource variables) { + this.variables = variables; + } + } -- 2.39.2