From 25bc28c54537916011279da1c2da3a4096b75b46 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Tue, 24 Apr 2012 18:12:30 +1000 Subject: [PATCH 1/2] 376801 Make JAAS login modules useable without jetty infrastructure --- .../jetty/plus/jaas/spi/AbstractLoginModule.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/jetty-plus/src/main/java/org/eclipse/jetty/plus/jaas/spi/AbstractLoginModule.java b/jetty-plus/src/main/java/org/eclipse/jetty/plus/jaas/spi/AbstractLoginModule.java index 61cbb6bf81d..4665aba6c10 100644 --- a/jetty-plus/src/main/java/org/eclipse/jetty/plus/jaas/spi/AbstractLoginModule.java +++ b/jetty-plus/src/main/java/org/eclipse/jetty/plus/jaas/spi/AbstractLoginModule.java @@ -24,6 +24,7 @@ import javax.security.auth.Subject; import javax.security.auth.callback.Callback; import javax.security.auth.callback.CallbackHandler; import javax.security.auth.callback.NameCallback; +import javax.security.auth.callback.PasswordCallback; import javax.security.auth.callback.UnsupportedCallbackException; import javax.security.auth.login.LoginException; import javax.security.auth.spi.LoginModule; @@ -187,9 +188,10 @@ public abstract class AbstractLoginModule implements LoginModule public Callback[] configureCallbacks () { - Callback[] callbacks = new Callback[2]; + Callback[] callbacks = new Callback[3]; callbacks[0] = new NameCallback("Enter user name"); callbacks[1] = new ObjectCallback(); + callbacks[2] = new PasswordCallback("Enter password", false); //only used if framework does not support the ObjectCallback return callbacks; } @@ -215,7 +217,11 @@ public abstract class AbstractLoginModule implements LoginModule callbackHandler.handle(callbacks); String webUserName = ((NameCallback)callbacks[0]).getName(); - Object webCredential = ((ObjectCallback)callbacks[1]).getObject(); + Object webCredential = null; + + webCredential = ((ObjectCallback)callbacks[1]).getObject(); //first check if ObjectCallback has the credential + if (webCredential == null) + webCredential = ((PasswordCallback)callbacks[2]).getPassword(); //use standard PasswordCallback if ((webUserName == null) || (webCredential == null)) { From 734f2bcae17d2e14cb5c8902932cf73057f4c697 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Tue, 24 Apr 2012 18:16:11 +1000 Subject: [PATCH 2/2] 371853 Support bundleentry: protocol for webapp embedded as directory in osgi bundle --- .../osgi/boot/internal/webapp/WebBundleDeployerHelper.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/internal/webapp/WebBundleDeployerHelper.java b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/internal/webapp/WebBundleDeployerHelper.java index a681396910e..67f5ccb17fd 100644 --- a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/internal/webapp/WebBundleDeployerHelper.java +++ b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/internal/webapp/WebBundleDeployerHelper.java @@ -241,7 +241,10 @@ public class WebBundleDeployerHelper implements IWebBundleDeployerHelper // classes // that the contributor gives access to. Thread.currentThread().setContextClassLoader(composite); - + + //converts bundleentry: protocol + baseWebappInstallURL = DefaultFileLocatorHelper.getLocalURL(baseWebappInstallURL); + context.setWar(baseWebappInstallURL.toString()); context.setContextPath(contextPath); context.setExtraClasspath(extraClasspath);