You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ay...@apache.org on 2015/02/05 17:15:48 UTC
cxf git commit: separate jetty8 and jetty9 dependencies in
systests/jaxrs 2
Repository: cxf
Updated Branches:
refs/heads/master 005ee936d -> 42eba2f94
separate jetty8 and jetty9 dependencies in systests/jaxrs 2
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/42eba2f9
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/42eba2f9
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/42eba2f9
Branch: refs/heads/master
Commit: 42eba2f948a967d62dc0257a920715ae47ae4310
Parents: 005ee93
Author: Akitoshi Yoshida <ay...@apache.org>
Authored: Thu Feb 5 17:14:58 2015 +0100
Committer: Akitoshi Yoshida <ay...@apache.org>
Committed: Thu Feb 5 17:14:58 2015 +0100
----------------------------------------------------------------------
.../systest/jaxrs/security/BookLoginModule.java | 30 ++++++++++++++++++--
1 file changed, 28 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/42eba2f9/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/BookLoginModule.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/BookLoginModule.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/BookLoginModule.java
index 113a734..ea42292 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/BookLoginModule.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/BookLoginModule.java
@@ -28,12 +28,17 @@ import javax.security.auth.login.LoginException;
import javax.security.auth.spi.LoginModule;
public class BookLoginModule implements LoginModule {
+ private static final Class<LoginModule> LOGIN_MODULE_C = getLoginModuleClass();
private LoginModule module;
private String fileResource;
public BookLoginModule() {
- module = new org.eclipse.jetty.jaas.spi.PropertyFileLoginModule();
+ try {
+ module = LOGIN_MODULE_C.newInstance();
+ } catch (Throwable ex) {
+ throw new RuntimeException(ex);
+ }
try {
fileResource = getClass()
.getResource("/org/apache/cxf/systest/jaxrs/security/jetty-realm.properties")
@@ -42,7 +47,28 @@ public class BookLoginModule implements LoginModule {
throw new RuntimeException(ex);
}
}
-
+
+ @SuppressWarnings("unchecked")
+ private static Class<LoginModule> getLoginModuleClass() {
+ Class<?> clz = null;
+ try {
+ // try the jetty9 version
+ clz = Class.forName("org.eclipse.jetty.jaas.spi.PropertyFileLoginModule",
+ true, BookLoginModule.class.getClassLoader());
+ } catch (Throwable t) {
+ if (clz == null) {
+ try {
+ // try the jetty8 version
+ clz = Class.forName("org.eclipse.jetty.plus.jaas.spi.PropertyFileLoginModule",
+ true, BookLoginModule.class.getClassLoader());
+ } catch (Throwable t2) {
+ // ignore
+ }
+ }
+ }
+ return (Class<LoginModule>)clz;
+ }
+
public boolean abort() throws LoginException {
return module.abort();
}