cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject cxf git commit: Moved JAX-RS kerberos tests to new module
Date Thu, 04 Dec 2014 11:17:58 GMT
Repository: cxf
Updated Branches:
  refs/heads/master d50ffd09c -> 5b4347ecd


Moved JAX-RS kerberos tests to new module


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/5b4347ec
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/5b4347ec
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/5b4347ec

Branch: refs/heads/master
Commit: 5b4347ecd64b0b607c5752569247a050d0cedc0f
Parents: d50ffd0
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Thu Dec 4 11:16:37 2014 +0000
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Thu Dec 4 11:16:37 2014 +0000

----------------------------------------------------------------------
 parent/pom.xml                                  |   6 +
 systests/jaxrs/pom.xml                          |   1 -
 .../jaxrs/security/BookKerberosServer.java      |  68 ------
 .../jaxrs/security/JAXRSKerberosBookTest.java   | 137 -----------
 .../cxf/systest/jaxrs/security/kerberos.cfg     |  22 --
 .../systest/jaxrs/security/kerberosClient.xml   |  47 ----
 systests/kerberos/pom.xml                       |  14 ++
 .../systest/kerberos/jaxrs/kerberos/Book.java   | 124 ++++++++++
 .../jaxrs/kerberos/BookKerberosServer.java      |  67 ++++++
 .../jaxrs/kerberos/BookNotFoundDetails.java     |  36 +++
 .../jaxrs/kerberos/BookNotFoundFault.java       |  41 ++++
 .../kerberos/jaxrs/kerberos/BookStore.java      |  80 +++++++
 .../kerberos/jaxrs/kerberos/BookStoreImpl.java  | 111 +++++++++
 .../kerberos/jaxrs/kerberos/Chapter.java        | 106 +++++++++
 .../jaxrs/kerberos/JAXRSKerberosBookTest.java   | 226 +++++++++++++++++++
 .../kerberos/jaxrs/kerberos/SuperBook.java      |  45 ++++
 .../jaxrs/kerberos/SuperBookInterface.java      |  23 ++
 .../kerberos/jaxrs/kerberos/kerberosClient.xml  |  47 ++++
 18 files changed, 926 insertions(+), 275 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/5b4347ec/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 7122127..5ee9829 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -89,6 +89,7 @@
         <cxf.httpcomponents.client.version>4.3.5</cxf.httpcomponents.client.version>
         <cxf.httpcomponents.core.version>4.3.3</cxf.httpcomponents.core.version>
         <cxf.httpcomponents.core.version.range>[4.3,4.4.0)</cxf.httpcomponents.core.version.range>
+        <cxf.jackson.version>2.4.1</cxf.jackson.version>
         <cxf.james.mim4j.version>0.7.2</cxf.james.mim4j.version>
         <cxf.logback.classic.version>1.0.13</cxf.logback.classic.version>
         <cxf.log4j.version>1.2.17</cxf.log4j.version>
@@ -1341,6 +1342,11 @@
                 <scope>test</scope>
             </dependency>
             <dependency>
+                <groupId>com.fasterxml.jackson.jaxrs</groupId>
+                <artifactId>jackson-jaxrs-json-provider</artifactId>
+                <version>${cxf.jackson.version}</version>
+            </dependency>
+            <dependency>
                 <groupId>${cxf.asm.groupId}</groupId>
                 <artifactId>${cxf.asm.artifactId}</artifactId>
                 <version>${cxf.asm.version}</version>

http://git-wip-us.apache.org/repos/asf/cxf/blob/5b4347ec/systests/jaxrs/pom.xml
----------------------------------------------------------------------
diff --git a/systests/jaxrs/pom.xml b/systests/jaxrs/pom.xml
index 42e36ef..b4e06f7 100644
--- a/systests/jaxrs/pom.xml
+++ b/systests/jaxrs/pom.xml
@@ -428,7 +428,6 @@
         <dependency>
             <groupId>com.fasterxml.jackson.jaxrs</groupId>
             <artifactId>jackson-jaxrs-json-provider</artifactId>
-            <version>2.4.1</version>
         </dependency>
         <dependency>
             <groupId>org.apache.httpcomponents</groupId>

http://git-wip-us.apache.org/repos/asf/cxf/blob/5b4347ec/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/BookKerberosServer.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/BookKerberosServer.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/BookKerberosServer.java
deleted file mode 100644
index 7e6df48..0000000
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/BookKerberosServer.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.cxf.systest.jaxrs.security;
-
-import javax.security.auth.callback.CallbackHandler;
-
-import org.apache.cxf.interceptor.security.NamePasswordCallbackHandler;
-import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
-import org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider;
-import org.apache.cxf.jaxrs.security.KerberosAuthenticationFilter;
-import org.apache.cxf.systest.jaxrs.BookStore;
-import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
-import org.apache.cxf.testutil.common.TestUtil;
-    
-public class BookKerberosServer extends AbstractBusTestServerBase {
-    public static final String PORT = TestUtil.getPortNumber("jaxrs-kerberos");
-    
-    protected void run() {
-        
-        JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
-        sf.setResourceClasses(BookStore.class);
-        //default lifecycle is per-request, change it to singleton
-        sf.setResourceProvider(BookStore.class,
-                               new SingletonResourceProvider(new BookStore()));
-        KerberosAuthenticationFilter filter = new KerberosAuthenticationFilter();
-        filter.setLoginContextName("KerberosServer");
-        filter.setCallbackHandler(getCallbackHandler("HTTP/localhost", "http"));
-        //filter.setLoginContextName("KerberosServerKeyTab");
-        //filter.setServicePrincipalName("HTTP/ktab");
-        sf.setProvider(filter);
-        sf.setAddress("http://localhost:" + PORT + "/");
-      
-        sf.create();        
-    }
-
-    public static void main(String[] args) {
-        try {
-            BookKerberosServer s = new BookKerberosServer();
-            s.start();
-        } catch (Exception ex) {
-            ex.printStackTrace();
-            System.exit(-1);
-        } finally {
-            System.out.println("done!");
-        }
-    }
-    
-    public static CallbackHandler getCallbackHandler(final String username, final String password) {
-        return new NamePasswordCallbackHandler(username, password);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf/blob/5b4347ec/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSKerberosBookTest.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSKerberosBookTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSKerberosBookTest.java
deleted file mode 100644
index 1a05eaa..0000000
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSKerberosBookTest.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.cxf.systest.jaxrs.security;
-
-import org.apache.cxf.configuration.security.AuthorizationPolicy;
-import org.apache.cxf.interceptor.LoggingOutInterceptor;
-import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
-import org.apache.cxf.jaxrs.client.WebClient;
-import org.apache.cxf.jaxrs.security.KerberosAuthOutInterceptor;
-import org.apache.cxf.systest.jaxrs.Book;
-import org.apache.cxf.systest.jaxrs.BookStore;
-import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
-import org.apache.cxf.transport.http.auth.HttpAuthHeader;
-
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-
-
-public class JAXRSKerberosBookTest extends AbstractBusClientServerTestBase {
-    public static final String PORT = BookKerberosServer.PORT;
-
-    private static final String KERBEROS_CONFIG_FILE =
-        "org/apache/cxf/systest/jaxrs/security/kerberosClient.xml";
-    
-    @BeforeClass
-    public static void startServers() throws Exception {
-        String jaasConfig = JAXRSKerberosBookTest.class
-            .getResource("/org/apache/cxf/systest/jaxrs/security/kerberos.cfg").toURI().getPath();
-        System.setProperty("java.security.auth.login.config", jaasConfig);
-
-        assertTrue("server did not launch correctly",
-                   launchServer(BookKerberosServer.class, true));
-    }
-    
-    @Test
-    @Ignore
-    public void testGetBookWithConfigInHttpConduit() throws Exception {
-        doTestGetBook123Proxy(KERBEROS_CONFIG_FILE);
-    }
-    
-    private void doTestGetBook123Proxy(String configFile) throws Exception {
-        BookStore bs = JAXRSClientFactory.create("http://localhost:" + PORT, BookStore.class, 
-                configFile);
-        WebClient.getConfig(bs).getOutInterceptors().add(new LoggingOutInterceptor());
-        // just to verify the interface call goes through CGLIB proxy too
-        assertEquals("http://localhost:" + PORT, WebClient.client(bs).getBaseURI().toString());
-        Book b = bs.getBook("123");
-        assertEquals(b.getId(), 123);
-        b = bs.getBook("123");
-        assertEquals(b.getId(), 123);
-    }
-    
-    @Test
-    @Ignore
-    public void testGetBookWithInterceptor() throws Exception {
-        WebClient wc = WebClient.create("http://localhost:" + PORT + "/bookstore/books/123");
-        
-        KerberosAuthOutInterceptor kbInterceptor = new KerberosAuthOutInterceptor();
-        
-        AuthorizationPolicy policy = new AuthorizationPolicy();
-        policy.setAuthorizationType(HttpAuthHeader.AUTH_TYPE_NEGOTIATE);
-        policy.setAuthorization("KerberosClient");
-        policy.setUserName("alice");
-        policy.setPassword("alice");
-        
-        kbInterceptor.setPolicy(policy);
-        kbInterceptor.setCredDelegation(true);
-        
-        WebClient.getConfig(wc).getOutInterceptors().add(new LoggingOutInterceptor());
-        WebClient.getConfig(wc).getOutInterceptors().add(kbInterceptor);
-        
-        Book b = wc.get(Book.class);
-        assertEquals(b.getId(), 123);
-    }
-    
-    @Test
-    @Ignore
-    public void testGetBookWithInterceptorAndKeyTab() throws Exception {
-        WebClient wc = WebClient.create("http://localhost:" + PORT + "/bookstore/books/123");
-        
-        KerberosAuthOutInterceptor kbInterceptor = new KerberosAuthOutInterceptor();
-        
-        AuthorizationPolicy policy = new AuthorizationPolicy();
-        policy.setAuthorizationType(HttpAuthHeader.AUTH_TYPE_NEGOTIATE);
-        policy.setAuthorization("KerberosClientKeyTab");
-        
-        kbInterceptor.setPolicy(policy);
-        kbInterceptor.setCredDelegation(true);
-        
-        WebClient.getConfig(wc).getOutInterceptors().add(new LoggingOutInterceptor());
-        WebClient.getConfig(wc).getOutInterceptors().add(kbInterceptor);
-        
-        Book b = wc.get(Book.class);
-        assertEquals(b.getId(), 123);
-    }
-    
-    @Test
-    @Ignore
-    public void testGetBookWithInterceptorServiceKeyTab() throws Exception {
-        WebClient wc = WebClient.create("http://localhost:" + PORT + "/bookstore/books/123");
-        
-        KerberosAuthOutInterceptor kbInterceptor = new KerberosAuthOutInterceptor();
-        
-        AuthorizationPolicy policy = new AuthorizationPolicy();
-        policy.setAuthorizationType(HttpAuthHeader.AUTH_TYPE_NEGOTIATE);
-        policy.setAuthorization("KerberosClient");
-        policy.setUserName("alice");
-        policy.setPassword("alice");
-        
-        kbInterceptor.setPolicy(policy);
-        kbInterceptor.setServicePrincipalName("HTTP/ktab");
-        
-        WebClient.getConfig(wc).getOutInterceptors().add(new LoggingOutInterceptor());
-        WebClient.getConfig(wc).getOutInterceptors().add(kbInterceptor);
-        
-        Book b = wc.get(Book.class);
-        assertEquals(b.getId(), 123);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf/blob/5b4347ec/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/kerberos.cfg
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/kerberos.cfg b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/kerberos.cfg
deleted file mode 100644
index 42f55d6..0000000
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/kerberos.cfg
+++ /dev/null
@@ -1,22 +0,0 @@
-KerberosClient {
-    com.sun.security.auth.module.Krb5LoginModule required client=TRUE;
-};
-KerberosClientKeyTab {
-    com.sun.security.auth.module.Krb5LoginModule required
-    client=TRUE
-    refreshKrb5Config=true
-    useKeyTab=true
-    keyTab="/etc/bob.keytab"
-    principal="bob";
-};
-KerberosServer {
-    com.sun.security.auth.module.Krb5LoginModule required storeKey=true;
-};
-KerberosServerKeyTab {
-    com.sun.security.auth.module.Krb5LoginModule required
-    storeKey=true
-    refreshKrb5Config=true
-    useKeyTab=true
-    keyTab="/etc/http.keytab"
-    principal="HTTP/ktab";
-};

http://git-wip-us.apache.org/repos/asf/cxf/blob/5b4347ec/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/kerberosClient.xml
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/kerberosClient.xml b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/kerberosClient.xml
deleted file mode 100644
index c0064bb..0000000
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/kerberosClient.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you 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.
--->
-<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:http="http://cxf.apache.org/transports/http/configuration" xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration" xmlns:sec="http://cxf.apache.org/configuration/security" xsi:schemaLocation="         http://www.springframework.org/schema/beans                 http://www.springframework.org/schema/beans/spring-beans.xsd         http://cxf.apache.org/transports/http/configuration         http://cxf.apache.org/schemas/configuration/http-conf.xsd         http://cxf.apache.org/transports/http-jetty/configuration   http://cxf.apache.org/schemas/configuration/http-jetty.xsd         http://cxf.apache.org/configuration/security                http://cxf.apache.org/schemas/configuration/security.xsd         ">
-    <!-- -->
-    <!-- HTTP/S configuration for proxy clients -->
-    <!-- -->
-    <http:conduit name="{http://jaxrs.systest.cxf.apache.org/}BookStore.http-conduit">
-        <http:client ConnectionTimeout="3000000" ReceiveTimeout="3000000"/>
-        <http:authorization>
-            <sec:UserName>alice</sec:UserName>
-            <sec:Password>alice</sec:Password>
-            <sec:AuthorizationType>Negotiate</sec:AuthorizationType>
-            <sec:Authorization>KerberosClient</sec:Authorization>
-        </http:authorization>
-    </http:conduit>
-    <!-- -->
-    <!-- HTTP/S configuration for web clients -->
-    <!--
-    
-    <http:conduit name="\{https://localhost\:.*\}WebClient\.http-conduit">
-        <http:client ConnectionTimeout="3000000" ReceiveTimeout="3000000"/>
-        <authorization>
-          <AuthorizationType>Negotiate</AuthorizationType>
-          <Authorization>KerberosClient</Authorization>
-          <UserName>alice</UserName>
-          <Password>alice</Password>
-        </authorization>
-    </http:conduit>
-    -->
-</beans>

http://git-wip-us.apache.org/repos/asf/cxf/blob/5b4347ec/systests/kerberos/pom.xml
----------------------------------------------------------------------
diff --git a/systests/kerberos/pom.xml b/systests/kerberos/pom.xml
index 0356ee9..719af69 100644
--- a/systests/kerberos/pom.xml
+++ b/systests/kerberos/pom.xml
@@ -114,6 +114,16 @@
         </dependency>
         <dependency>
             <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-rs-client</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-rs-extension-search</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-rt-bindings-soap</artifactId>
             <version>${project.version}</version>
         </dependency>
@@ -181,6 +191,10 @@
             <artifactId>FastInfoset</artifactId>
         </dependency>
         <dependency>
+            <groupId>com.fasterxml.jackson.jaxrs</groupId>
+            <artifactId>jackson-jaxrs-json-provider</artifactId>
+        </dependency>
+        <dependency>
             <groupId>org.bouncycastle</groupId>
             <artifactId>bcprov-jdk15on</artifactId>
             <scope>test</scope>

http://git-wip-us.apache.org/repos/asf/cxf/blob/5b4347ec/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/Book.java
----------------------------------------------------------------------
diff --git a/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/Book.java b/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/Book.java
new file mode 100644
index 0000000..88e7c96
--- /dev/null
+++ b/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/Book.java
@@ -0,0 +1,124 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.systest.kerberos.jaxrs.kerberos;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlSeeAlso;
+
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+import com.fasterxml.jackson.annotation.JsonTypeInfo.As;
+import com.fasterxml.jackson.annotation.JsonTypeInfo.Id;
+
+@JsonTypeInfo(use = Id.CLASS, include = As.PROPERTY, property = "class")
+@XmlRootElement(name = "Book")
+@XmlSeeAlso(SuperBook.class)
+public class Book {
+    private String name;
+    private long id;
+    private Map<Long, Chapter> chapters = new HashMap<Long, Chapter>();
+    
+    public Book() {
+        init();
+        //System.out.println("----chapters: " + chapters.size());
+    }
+    
+    public Book(String name, long id) {
+        this.name = name;
+        this.id = id;
+    }
+    
+    public void setName(String n) {
+        name = n;
+    }
+
+    public String getName() {
+        return name;
+    }
+    
+    public void setId(long i) {
+        id = i;
+    }
+    public long getId() {
+        return id;
+    }
+    
+    @PUT
+    public void cloneState(Book book) {
+        id = book.getId();
+        name = book.getName();
+    }
+    
+    @GET
+    public Book retrieveState() {
+        return this;
+    }
+    
+    @GET
+    @Path("chapters/{chapterid}/")    
+    @Produces("application/xml;charset=ISO-8859-1")
+    public Chapter getChapter(@PathParam("chapterid")int chapterid) {
+        return chapters.get(new Long(chapterid));
+    }
+    
+    @GET
+    @Path("chapters/acceptencoding/{chapterid}/")    
+    @Produces("application/xml")
+    public Chapter getChapterAcceptEncoding(@PathParam("chapterid")int chapterid) {
+        return chapters.get(new Long(chapterid));
+    }
+
+    @GET
+    @Path("chapters/badencoding/{chapterid}/")    
+    @Produces("application/xml;charset=UTF-48")
+    public Chapter getChapterBadEncoding(@PathParam("chapterid")int chapterid) {
+        return chapters.get(new Long(chapterid));
+    }
+    
+    @Path("chapters/sub/{chapterid}/")    
+    public Chapter getSubChapter(@PathParam("chapterid")int chapterid) {
+        return chapters.get(new Long(chapterid));
+    }
+    
+    @Path("chaptersobject/sub/{chapterid}/")    
+    public Object getSubChapterObject(@PathParam("chapterid")int chapterid) {
+        return getSubChapter(chapterid);
+    }
+    
+    
+    final void init() {
+        Chapter c1 = new Chapter();
+        c1.setId(1);
+        c1.setTitle("chapter 1");
+        chapters.put(c1.getId(), c1);
+        Chapter c2 = new Chapter();
+        c2.setId(2);
+        c2.setTitle("chapter 2");
+        chapters.put(c2.getId(), c2);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/5b4347ec/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/BookKerberosServer.java
----------------------------------------------------------------------
diff --git a/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/BookKerberosServer.java b/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/BookKerberosServer.java
new file mode 100644
index 0000000..753b48f
--- /dev/null
+++ b/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/BookKerberosServer.java
@@ -0,0 +1,67 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.systest.kerberos.jaxrs.kerberos;
+
+import javax.security.auth.callback.CallbackHandler;
+
+import org.apache.cxf.interceptor.security.NamePasswordCallbackHandler;
+import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
+import org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider;
+import org.apache.cxf.jaxrs.security.KerberosAuthenticationFilter;
+import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+import org.apache.cxf.testutil.common.TestUtil;
+    
+public class BookKerberosServer extends AbstractBusTestServerBase {
+    public static final String PORT = TestUtil.getPortNumber("jaxrs-kerberos");
+    
+    protected void run() {
+        
+        JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
+        sf.setResourceClasses(BookStore.class);
+        //default lifecycle is per-request, change it to singleton
+        sf.setResourceProvider(BookStore.class,
+                               new SingletonResourceProvider(new BookStoreImpl()));
+        KerberosAuthenticationFilter filter = new KerberosAuthenticationFilter();
+        filter.setLoginContextName("bob");
+        filter.setCallbackHandler(getCallbackHandler("bob", "bob"));
+        //filter.setLoginContextName("KerberosServerKeyTab");
+        //filter.setServicePrincipalName("HTTP/ktab");
+        sf.setProvider(filter);
+        sf.setAddress("http://localhost:" + PORT + "/");
+      
+        sf.create();        
+    }
+
+    public static void main(String[] args) {
+        try {
+            BookKerberosServer s = new BookKerberosServer();
+            s.start();
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            System.exit(-1);
+        } finally {
+            System.out.println("done!");
+        }
+    }
+    
+    public static CallbackHandler getCallbackHandler(final String username, final String password) {
+        return new NamePasswordCallbackHandler(username, password);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/5b4347ec/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/BookNotFoundDetails.java
----------------------------------------------------------------------
diff --git a/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/BookNotFoundDetails.java b/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/BookNotFoundDetails.java
new file mode 100644
index 0000000..01de35b
--- /dev/null
+++ b/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/BookNotFoundDetails.java
@@ -0,0 +1,36 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.systest.kerberos.jaxrs.kerberos;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement
+public class BookNotFoundDetails {
+    private long id;
+
+    public long getId() {
+        return id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/5b4347ec/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/BookNotFoundFault.java
----------------------------------------------------------------------
diff --git a/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/BookNotFoundFault.java b/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/BookNotFoundFault.java
new file mode 100644
index 0000000..3e401c8
--- /dev/null
+++ b/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/BookNotFoundFault.java
@@ -0,0 +1,41 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.systest.kerberos.jaxrs.kerberos;
+
+import javax.xml.ws.WebFault;
+
+@WebFault
+public class BookNotFoundFault extends Exception {
+    private static final long serialVersionUID = 4833573020359208072L;
+    private BookNotFoundDetails details;
+
+    public BookNotFoundFault(String errorMessage) {
+        super(errorMessage);
+    }
+    
+    public BookNotFoundFault(BookNotFoundDetails details) {
+        super();
+        this.details = details;
+    }
+
+    public BookNotFoundDetails getFaultInfo() {
+        return details;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/5b4347ec/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/BookStore.java
----------------------------------------------------------------------
diff --git a/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/BookStore.java b/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/BookStore.java
new file mode 100644
index 0000000..7639aa7
--- /dev/null
+++ b/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/BookStore.java
@@ -0,0 +1,80 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.systest.kerberos.jaxrs.kerberos;
+
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+
+import org.apache.cxf.annotations.GZIP;
+
+@Path("/bookstore")
+@GZIP(threshold = 1)
+public interface BookStore {
+    
+    @GET
+    @Path("/")
+    Book getBookRoot();
+    
+    @Path("/default")
+    @Produces("application/xml")
+    Book getDefaultBook();
+    
+    @GET
+    @Path("/books/{bookId}/")
+    @Produces("application/xml")
+    Book getBook(@PathParam("bookId") String id) throws BookNotFoundFault;
+    
+    @GET
+    @Path("/books/query/default")
+    @Produces("application/xml")
+    Book getBook(@QueryParam("bookId") long id) throws BookNotFoundFault;
+    
+    @GET
+    @Path("/the books/{bookId}/")
+    @Produces("application/xml")
+    Book getBookWithSpace(@PathParam("bookId") String id) throws BookNotFoundFault;
+    
+    @PathParam("bookId")
+    void setBookId(String id);
+    
+    void setDefaultNameAndId(String name, long id);
+    
+    @GET
+    @Path("/books/{bookId}/")
+    @Produces("application/json;qs=0.9")
+    Book getBookAsJSON() throws BookNotFoundFault;
+    
+    public static class BookNotReturnedException extends RuntimeException {
+
+        private static final long serialVersionUID = 4935423670510083220L;
+
+        public BookNotReturnedException(String errorMessage) {
+            super(errorMessage);
+        }
+        
+    }
+    
+}
+
+

http://git-wip-us.apache.org/repos/asf/cxf/blob/5b4347ec/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/BookStoreImpl.java
----------------------------------------------------------------------
diff --git a/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/BookStoreImpl.java b/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/BookStoreImpl.java
new file mode 100644
index 0000000..045d93d
--- /dev/null
+++ b/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/BookStoreImpl.java
@@ -0,0 +1,111 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.systest.kerberos.jaxrs.kerberos;
+
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.ws.rs.PathParam;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.UriInfo;
+
+public class BookStoreImpl implements BookStore {
+    private Map<Long, Book> books = new HashMap<Long, Book>();
+    private long bookId = 123;
+    
+    private String defaultName;
+    private long defaultId;
+    
+    private String currentBookId;
+    
+    public BookStoreImpl() {
+        init();
+    }
+    public BookStoreImpl(UriInfo ui) {
+        init();
+    }
+    
+    @Override
+    public Book getBookRoot() {
+        return new Book("root", 124L);
+    }
+    
+    @Override
+    public Book getDefaultBook() {
+        return new Book(defaultName, defaultId);
+    }
+
+    @Override
+    public Book getBook(@PathParam("bookId") String id) throws BookNotFoundFault {
+        return doGetBook(id);
+    }
+
+    @Override
+    public Book getBook(@QueryParam("bookId") long id) throws BookNotFoundFault {
+        return books.get(id + 123);
+    }
+
+    @Override
+    public Book getBookWithSpace(@PathParam("bookId") String id) throws BookNotFoundFault {
+        return doGetBook(id);
+    }
+
+    @Override
+    public void setBookId(String id) {
+        currentBookId = id;
+    }
+    
+    public void setDefaultNameAndId(String name, long id) {
+        defaultName = name;
+        defaultId = id;
+    }
+
+    @Override
+    public Book getBookAsJSON() throws BookNotFoundFault {
+        return doGetBook(currentBookId);
+    }
+    
+    private Book doGetBook(String id) throws BookNotFoundFault {
+        Book book = books.get(Long.parseLong(id));
+        if (book != null) {
+            return book;
+        } else {
+            BookNotFoundDetails details = new BookNotFoundDetails();
+            details.setId(Long.parseLong(id));
+            throw new BookNotFoundFault(details);
+        }
+    }
+
+    public final String init() {
+        books.clear();
+        bookId = 123;
+        
+        Book book = new Book();
+        book.setId(bookId);
+        book.setName("CXF in Action");
+        books.put(book.getId(), book);
+
+        return "OK";
+    }
+    
+}
+
+

http://git-wip-us.apache.org/repos/asf/cxf/blob/5b4347ec/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/Chapter.java
----------------------------------------------------------------------
diff --git a/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/Chapter.java b/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/Chapter.java
new file mode 100644
index 0000000..eaebf50
--- /dev/null
+++ b/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/Chapter.java
@@ -0,0 +1,106 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.systest.kerberos.jaxrs.kerberos;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.UriInfo;
+import javax.xml.bind.annotation.XmlRootElement;
+
+
+@XmlRootElement(name = "Chapter")
+public class Chapter {
+    private String title;
+    private long id;
+    
+    public Chapter() {
+    }
+    
+    public void setTitle(String n) {
+        title = n;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+    
+    public void setId(long i) {
+        id = i;
+    }
+    public long getId() {
+        return id;
+    }
+    
+    @GET
+    @Path("/recurse")
+    @Produces("application/xml")
+    public Chapter getItself() {
+        return this;
+    }
+    
+    @Path("/recurse2")
+    public Chapter getItself2() {
+        return this;
+    }
+    
+    @GET
+    @Produces("application/xml;charset=ISO-8859-1")
+    public Chapter get() {
+        return this;
+    }
+    
+    @GET
+    @Path("/ids")
+    @Produces("application/xml;charset=ISO-8859-1")
+    public Chapter getWithBookId(@PathParam("bookId") int bookId,
+                                 @PathParam("chapterid") int chapterId) {
+        if (bookId != 123 || chapterId != 1) {
+            throw new RuntimeException();
+        }
+        return this;
+    }
+
+    
+    @GET
+    @Path("/matched-resources")
+    @Produces("text/plain")
+    public String getMatchedResources(@Context UriInfo ui) {
+        List<String> list = new ArrayList<String>();
+        for (Object obj : ui.getMatchedResources()) {
+            list.add(obj.toString());
+        }
+        return list.toString();
+    }
+
+    @GET
+    @Path("/matched%21uris")
+    @Produces("text/plain")
+    public String getMatchedUris(@Context UriInfo ui, 
+                                 @QueryParam("decode") String decode) {
+        return ui.getMatchedURIs(Boolean.parseBoolean(decode)).toString();        
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/5b4347ec/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/JAXRSKerberosBookTest.java
----------------------------------------------------------------------
diff --git a/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/JAXRSKerberosBookTest.java b/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/JAXRSKerberosBookTest.java
new file mode 100644
index 0000000..0aef664
--- /dev/null
+++ b/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/JAXRSKerberosBookTest.java
@@ -0,0 +1,226 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.systest.kerberos.jaxrs.kerberos;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.cxf.configuration.security.AuthorizationPolicy;
+import org.apache.cxf.interceptor.LoggingOutInterceptor;
+import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
+import org.apache.cxf.jaxrs.client.WebClient;
+import org.apache.cxf.jaxrs.security.KerberosAuthOutInterceptor;
+import org.apache.cxf.systest.kerberos.common.SecurityTestUtil;
+import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+import org.apache.cxf.transport.http.auth.HttpAuthHeader;
+import org.apache.cxf.transport.http.auth.SpnegoAuthSupplier;
+import org.apache.directory.server.annotations.CreateKdcServer;
+import org.apache.directory.server.annotations.CreateLdapServer;
+import org.apache.directory.server.annotations.CreateTransport;
+import org.apache.directory.server.core.annotations.ApplyLdifFiles;
+import org.apache.directory.server.core.annotations.CreateDS;
+import org.apache.directory.server.core.annotations.CreateIndex;
+import org.apache.directory.server.core.annotations.CreatePartition;
+import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
+import org.apache.directory.server.core.integ.FrameworkRunner;
+import org.apache.directory.server.core.kerberos.KeyDerivationInterceptor;
+import org.ietf.jgss.GSSName;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * A set of tests for Kerberos Tokens that use an Apache DS instance as the KDC.
+ */
+
+@RunWith(FrameworkRunner.class)
+
+//Define the DirectoryService
+@CreateDS(name = "AbstractKerberosTest-class",
+    enableAccessControl = false,
+    allowAnonAccess = false,
+    enableChangeLog = true,
+    partitions = {
+        @CreatePartition(
+            name = "example",
+            suffix = "dc=example,dc=com",
+            indexes = {
+                @CreateIndex(attribute = "objectClass"),
+                @CreateIndex(attribute = "dc"),
+                @CreateIndex(attribute = "ou")
+            }
+        ) },
+    additionalInterceptors = {
+        KeyDerivationInterceptor.class
+        }
+)
+
+@CreateLdapServer(
+    transports = {
+        @CreateTransport(protocol = "LDAP")
+        }
+)
+
+@CreateKdcServer(
+    transports = {
+        // @CreateTransport(protocol = "TCP", address = "127.0.0.1", port=1024)
+        @CreateTransport(protocol = "UDP", address = "127.0.0.1")
+        },
+    primaryRealm = "service.ws.apache.org",
+    kdcPrincipal = "krbtgt/service.ws.apache.org@service.ws.apache.org"
+)
+
+//Inject an file containing entries
+@ApplyLdifFiles("kerberos.ldif")
+
+public class JAXRSKerberosBookTest extends AbstractLdapTestUnit {
+    public static final String PORT = BookKerberosServer.PORT;
+
+    private static final String KERBEROS_CONFIG_FILE =
+        "org/apache/cxf/systest/kerberos/jaxrs/kerberos/kerberosClient.xml";
+    
+    private static boolean runTests;
+    private static boolean portUpdated;
+    
+    @Before
+    public void updatePort() throws Exception {
+        if (!portUpdated) {
+            String basedir = System.getProperty("basedir");
+            if (basedir == null) {
+                basedir = new File(".").getCanonicalPath();
+            }
+            
+            // Read in krb5.conf and substitute in the correct port
+            File f = new File(basedir + "/src/test/resources/krb5.conf");
+            
+            FileInputStream inputStream = new FileInputStream(f);
+            String content = IOUtils.toString(inputStream, "UTF-8");
+            inputStream.close();
+            content = content.replaceAll("port", "" + super.getKdcServer().getTransports()[0].getPort());
+            
+            File f2 = new File(basedir + "/target/test-classes/krb5.conf");
+            FileOutputStream outputStream = new FileOutputStream(f2);
+            IOUtils.write(content, outputStream, "UTF-8");
+            outputStream.close();
+            
+            System.setProperty("java.security.krb5.conf", f2.getPath());
+            
+            portUpdated = true;
+        }
+    }
+    
+    @BeforeClass
+    public static void startServers() throws Exception {
+
+        //
+        // This test fails with the IBM JDK
+        //
+        if (!"IBM Corporation".equals(System.getProperty("java.vendor"))) {
+            runTests = true;
+            String basedir = System.getProperty("basedir");
+            if (basedir == null) {
+                basedir = new File(".").getCanonicalPath();
+            } else {
+                basedir += "/..";
+            }
+
+            // System.setProperty("sun.security.krb5.debug", "true");
+            System.setProperty("java.security.auth.login.config", 
+                               basedir + "/kerberos/src/test/resources/kerberos.jaas");
+            
+        }
+        
+        // Launch servers
+        org.junit.Assert.assertTrue(
+            "Server failed to launch",
+            // run the server in the same process
+            // set this to false to fork
+            AbstractBusClientServerTestBase.launchServer(BookKerberosServer.class, true)
+        );
+    }
+
+    @org.junit.AfterClass
+    public static void cleanup() throws Exception {
+        SecurityTestUtil.cleanup();
+        AbstractBusClientServerTestBase.stopAllServers();
+    }
+    
+    @Test
+    public void testGetBookWithConfigInHttpConduit() throws Exception {
+        if (!runTests) {
+            return;
+        }
+        
+        doTestGetBook123Proxy(KERBEROS_CONFIG_FILE);
+    }
+    
+    private void doTestGetBook123Proxy(String configFile) throws Exception {
+        BookStore bs = JAXRSClientFactory.create("http://localhost:" + PORT, BookStore.class, 
+                configFile);
+        WebClient.getConfig(bs).getOutInterceptors().add(new LoggingOutInterceptor());
+        
+        SpnegoAuthSupplier authSupplier = new SpnegoAuthSupplier();
+        authSupplier.setServicePrincipalName("bob@service.ws.apache.org");
+        authSupplier.setServiceNameType(GSSName.NT_HOSTBASED_SERVICE);
+        WebClient.getConfig(bs).getHttpConduit().setAuthSupplier(authSupplier);
+        
+        // just to verify the interface call goes through CGLIB proxy too
+        Assert.assertEquals("http://localhost:" + PORT, WebClient.client(bs).getBaseURI().toString());
+        Book b = bs.getBook("123");
+        Assert.assertEquals(b.getId(), 123);
+        b = bs.getBook("123");
+        Assert.assertEquals(b.getId(), 123);
+    }
+    
+    @Test
+    public void testGetBookWithInterceptor() throws Exception {
+        if (!runTests) {
+            return;
+        }
+        
+        WebClient wc = WebClient.create("http://localhost:" + PORT + "/bookstore/books/123");
+        
+        KerberosAuthOutInterceptor kbInterceptor = new KerberosAuthOutInterceptor();
+        
+        AuthorizationPolicy policy = new AuthorizationPolicy();
+        policy.setAuthorizationType(HttpAuthHeader.AUTH_TYPE_NEGOTIATE);
+        policy.setAuthorization("alice");
+        policy.setUserName("alice");
+        policy.setPassword("alice");
+
+        kbInterceptor.setPolicy(policy);
+        kbInterceptor.setCredDelegation(true);
+        
+        WebClient.getConfig(wc).getOutInterceptors().add(new LoggingOutInterceptor());
+        WebClient.getConfig(wc).getOutInterceptors().add(kbInterceptor);
+        
+        // Required so as to get it working with our KDC
+        kbInterceptor.setServicePrincipalName("bob@service.ws.apache.org");
+        kbInterceptor.setServiceNameType(GSSName.NT_HOSTBASED_SERVICE);
+        
+        Book b = wc.get(Book.class);
+        Assert.assertEquals(b.getId(), 123);
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/5b4347ec/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/SuperBook.java
----------------------------------------------------------------------
diff --git a/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/SuperBook.java b/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/SuperBook.java
new file mode 100644
index 0000000..4cdbfe2
--- /dev/null
+++ b/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/SuperBook.java
@@ -0,0 +1,45 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.systest.kerberos.jaxrs.kerberos;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+
+@XmlRootElement(name = "SuperBook")
+public class SuperBook extends Book implements SuperBookInterface {
+    private boolean superBook;
+    
+    public SuperBook() {
+        
+    }
+    
+    public SuperBook(String name, long id, boolean superStatus) {
+        super(name, id);
+        this.superBook = superStatus;
+    }
+
+    public boolean isSuperBook() {
+        return superBook;
+    }
+
+    public void setSuperBook(boolean superBook) {
+        this.superBook = superBook;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/5b4347ec/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/SuperBookInterface.java
----------------------------------------------------------------------
diff --git a/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/SuperBookInterface.java b/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/SuperBookInterface.java
new file mode 100644
index 0000000..4b04413
--- /dev/null
+++ b/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/SuperBookInterface.java
@@ -0,0 +1,23 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.systest.kerberos.jaxrs.kerberos;
+
+public interface SuperBookInterface {
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/5b4347ec/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/kerberosClient.xml
----------------------------------------------------------------------
diff --git a/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/kerberosClient.xml b/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/kerberosClient.xml
new file mode 100644
index 0000000..e8a093a
--- /dev/null
+++ b/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/kerberosClient.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you 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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:http="http://cxf.apache.org/transports/http/configuration" xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration" xmlns:sec="http://cxf.apache.org/configuration/security" xsi:schemaLocation="         http://www.springframework.org/schema/beans                 http://www.springframework.org/schema/beans/spring-beans.xsd         http://cxf.apache.org/transports/http/configuration         http://cxf.apache.org/schemas/configuration/http-conf.xsd         http://cxf.apache.org/transports/http-jetty/configuration   http://cxf.apache.org/schemas/configuration/http-jetty.xsd         http://cxf.apache.org/configuration/security                http://cxf.apache.org/schemas/configuration/security.xsd         ">
+    <!-- -->
+    <!-- HTTP/S configuration for proxy clients -->
+    <!-- -->
+    <http:conduit name="{http://kerberos.jaxrs.kerberos.systest.cxf.apache.org/}BookStore.http-conduit">
+        <http:client ConnectionTimeout="3000000" ReceiveTimeout="3000000"/>
+        <http:authorization>
+            <sec:UserName>alice</sec:UserName>
+            <sec:Password>alice</sec:Password>
+            <sec:AuthorizationType>Negotiate</sec:AuthorizationType>
+            <sec:Authorization>alice</sec:Authorization>
+        </http:authorization>
+    </http:conduit>
+    <!-- -->
+    <!-- HTTP/S configuration for web clients -->
+    <!--
+    
+    <http:conduit name="\{https://localhost\:.*\}WebClient\.http-conduit">
+        <http:client ConnectionTimeout="3000000" ReceiveTimeout="3000000"/>
+        <authorization>
+          <AuthorizationType>Negotiate</AuthorizationType>
+          <Authorization>alice</Authorization>
+          <UserName>alice</UserName>
+          <Password>alice</Password>
+        </authorization>
+    </http:conduit>
+    -->
+</beans>


Mime
View raw message