Merge "Bug 2515 - Jersey to support JAX-RS 2.0"
authorRyan Goulding <ryandgoulding@gmail.com>
Thu, 29 Oct 2015 14:32:46 +0000 (14:32 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Thu, 29 Oct 2015 14:32:46 +0000 (14:32 +0000)
19 files changed:
README.md
aaa-authn-basic/pom.xml
aaa-authn-basic/src/main/java/org/opendaylight/aaa/basic/HttpBasicAuth.java
aaa-authn-basic/src/test/java/org/opendaylight/aaa/basic/HttpBasicAuthTest.java
aaa-authn-federation/pom.xml
aaa-authn-keystone/pom.xml
aaa-authn-sssd/pom.xml
aaa-authn-sts/pom.xml
aaa-authn-sts/src/main/java/org/opendaylight/aaa/sts/TokenAuthFilter.java
aaa-authn-sts/src/test/java/org/opendaylight/aaa/sts/TokenAuthTest.java
aaa-authn/pom.xml
aaa-idmlight/pom.xml
aaa-idmlight/src/main/java/org/opendaylight/aaa/idm/IdmLightApplication.java
aaa-idmlight/src/main/resources/WEB-INF/web.xml
aaa-shiro/pom.xml
features/authn/pom.xml
features/authn/src/main/features/features.xml
features/shiro/src/main/features/features.xml
parent/pom.xml

index 86303e17b4c9c9b25a5a6a197712bd00b4f40a38..f687fce8a07a1a609fa667765b80d903e1db64a8 100644 (file)
--- a/README.md
+++ b/README.md
@@ -50,7 +50,7 @@ Add the AAA `TokeAuthFilter` filter to your REST resource (RESTconf example):
 
     <servlet>
         <servlet-name>JAXRSRestconf</servlet-name>
-        <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
+        <servlet-class>org.glassfish.jersey.core.spi.container.servlet.ServletContainer</servlet-class>
         <init-param>
             <param-name>javax.ws.rs.Application</param-name>
             <param-value>org.opendaylight.controller.sal.rest.impl.RestconfApplication</param-value>
@@ -58,7 +58,7 @@ Add the AAA `TokeAuthFilter` filter to your REST resource (RESTconf example):
         
         <!-- Token Auth Filter -->
         <init-param>
-            <param-name>com.sun.jersey.spi.container.ContainerRequestFilters</param-name>
+            <param-name>org.glassfish.jersey.core.spi.container.ContainerRequestFilters</param-name>
             <param-value>
                 org.opendaylight.aaa.sts.TokenAuthFilter
             </param-value>
index 726a6bc09c261e472b70a86fc158de41f83d0387..bd47373adf5966110b99ebb8e7e3f891fd234384 100644 (file)
             <artifactId>slf4j-api</artifactId>
         </dependency>
         <dependency>
-            <groupId>com.sun.jersey</groupId>
+            <groupId>org.glassfish.jersey.core</groupId>
             <artifactId>jersey-server</artifactId>
             <scope>provided</scope>
         </dependency>
+        <dependency>
+            <groupId>org.glassfish.jersey.core</groupId>
+            <artifactId>jersey-common</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
             <artifactId>org.osgi.core</artifactId>
index 035df2bea1b75033fc94c7edc3076434729e1bdb..45ef68f76a40908b15cebd14fe1524e37f684757 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.aaa.basic;
 import java.util.List;
 import java.util.Map;
 
+import org.glassfish.jersey.internal.util.Base64;
 import org.opendaylight.aaa.AuthenticationBuilder;
 import org.opendaylight.aaa.PasswordCredentialBuilder;
 import org.opendaylight.aaa.api.Authentication;
@@ -22,8 +23,6 @@ import org.opendaylight.aaa.api.TokenAuth;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.sun.jersey.core.util.Base64;
-
 /**
  * An HTTP Basic authenticator.  Note that this is provided as a Hydrogen
  * backward compatible authenticator, but usage of this authenticator or
@@ -77,8 +76,8 @@ public class HttpBasicAuth implements TokenAuth {
     }
 
     private static String [] extractCredentialArray(final String authHeader) {
-        return new String(Base64.base64Decode(authHeader
-                .substring(BASIC_PREFIX.length()))).split(AUTH_SEP);
+        return new String(Base64.decode(authHeader
+                .substring(BASIC_PREFIX.length()).getBytes())).split(AUTH_SEP);
     }
 
     private static boolean verifyCredentialArray(final String [] creds) {
index 253b38754883ce45c096f1b886cef51e9d52ece4..aa2696c6e7a9ff5363542ed680e8af7c03b7144a 100644 (file)
@@ -19,6 +19,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import org.glassfish.jersey.internal.util.Base64;
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.aaa.ClaimBuilder;
@@ -27,8 +28,6 @@ import org.opendaylight.aaa.api.AuthenticationException;
 import org.opendaylight.aaa.api.Claim;
 import org.opendaylight.aaa.api.CredentialAuth;
 
-import com.sun.jersey.core.util.Base64;
-
 public class HttpBasicAuthTest {
     private static final String USERNAME = "admin";
     private static final String PASSWORD = "admin";
index 56d9e537306dcec739f60c3cc3f91aaa9c67e535..9abf529c76dc3fe1f86aab238e95c87cfc1b90e8 100644 (file)
@@ -10,7 +10,6 @@
     </parent>
 
     <artifactId>aaa-authn-federation</artifactId>
-    <version>0.3.0-SNAPSHOT</version>
     <packaging>bundle</packaging>
 
     <dependencies>
             <artifactId>slf4j-api</artifactId>
         </dependency>
         <dependency>
-            <groupId>com.sun.jersey</groupId>
+            <groupId>org.glassfish.jersey.core</groupId>
             <artifactId>jersey-server</artifactId>
             <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>javax.servlet</groupId>
-            <artifactId>servlet-api</artifactId>
+            <artifactId>javax.servlet-api</artifactId>
             <scope>provided</scope>
         </dependency>
         <dependency>
@@ -63,8 +62,8 @@
         </dependency>
         <!-- Testing Dependencies -->
         <dependency>
-            <groupId>com.sun.jersey.jersey-test-framework</groupId>
-            <artifactId>jersey-test-framework-grizzly2</artifactId>
+            <groupId>org.glassfish.jersey.test-framework.providers</groupId>
+            <artifactId>jersey-test-framework-provider-grizzly2</artifactId>
             <scope>test</scope>
         </dependency>
         <dependency>
@@ -97,7 +96,6 @@
                 <extensions>true</extensions>
                 <configuration>
                     <instructions>
-                        <Import-Package>*,com.sun.jersey.spi.container.servlet</Import-Package>
                         <Web-ContextPath>/oauth2/federation</Web-ContextPath>
                         <Web-Connectors>federationConn</Web-Connectors>
                         <Bundle-Activator>org.opendaylight.aaa.federation.Activator</Bundle-Activator>
index 305289e18f8395b296ece90e37697017bd71fcaf..2ab36d24385ab5fabc56c2107609565a40793dc6 100644 (file)
             <artifactId>slf4j-api</artifactId>
         </dependency>
         <dependency>
-            <groupId>com.sun.jersey</groupId>
+            <groupId>org.glassfish.jersey.core</groupId>
             <artifactId>jersey-server</artifactId>
             <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>javax.servlet</groupId>
-            <artifactId>servlet-api</artifactId>
+            <artifactId>javax.servlet-api</artifactId>
             <scope>provided</scope>
         </dependency>
         <dependency>
@@ -73,8 +73,8 @@
         </dependency>
         <!-- Testing Dependencies -->
         <dependency>
-            <groupId>com.sun.jersey.jersey-test-framework</groupId>
-            <artifactId>jersey-test-framework-grizzly2</artifactId>
+            <groupId>org.glassfish.jersey.test-framework.providers</groupId>
+            <artifactId>jersey-test-framework-provider-grizzly2</artifactId>
             <scope>test</scope>
         </dependency>
         <dependency>
index 151c39ee134bb4f6df231c9fab855b3452963ab8..b52fdcbb7d4c38e95efb9d103896567300c31a6c 100644 (file)
       <artifactId>slf4j-api</artifactId>
     </dependency>
     <dependency>
-      <groupId>com.sun.jersey</groupId>
+      <groupId>org.glassfish.jersey.core</groupId>
       <artifactId>jersey-server</artifactId>
       <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>javax.servlet</groupId>
-      <artifactId>servlet-api</artifactId>
+      <artifactId>javax.servlet-api</artifactId>
       <scope>provided</scope>
     </dependency>
     <dependency>
@@ -55,8 +55,8 @@
     </dependency>    
     <!-- Testing Dependencies -->
     <dependency>
-      <groupId>com.sun.jersey.jersey-test-framework</groupId>
-      <artifactId>jersey-test-framework-grizzly2</artifactId>
+      <groupId>org.glassfish.jersey.test-framework.providers</groupId>
+      <artifactId>jersey-test-framework-provider-grizzly2</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>
index 58a8b22068d7f2c26a8f5a8b178f1e236e69d333..4a447b770e72982445a2afe6bcfb53701c9c0efa 100644 (file)
             <artifactId>slf4j-api</artifactId>
         </dependency>
         <dependency>
-            <groupId>com.sun.jersey</groupId>
+            <groupId>org.glassfish.jersey.core</groupId>
             <artifactId>jersey-server</artifactId>
             <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>javax.servlet</groupId>
-            <artifactId>servlet-api</artifactId>
+            <artifactId>javax.servlet-api</artifactId>
             <scope>provided</scope>
         </dependency>
         <dependency>
@@ -63,8 +63,8 @@
         </dependency>
         <!-- Testing Dependencies -->     
         <dependency>
-            <groupId>com.sun.jersey.jersey-test-framework</groupId>
-            <artifactId>jersey-test-framework-grizzly2</artifactId>
+            <groupId>org.glassfish.jersey.test-framework.providers</groupId>
+            <artifactId>jersey-test-framework-provider-grizzly2</artifactId>
             <scope>test</scope>
         </dependency>
         <dependency>
@@ -97,7 +97,6 @@
                 <extensions>true</extensions>
                 <configuration>
                     <instructions>
-                        <Import-Package>*,com.sun.jersey.spi.container.servlet</Import-Package>
                         <Web-ContextPath>/oauth2</Web-ContextPath>
                         <Bundle-Activator>org.opendaylight.aaa.sts.Activator</Bundle-Activator>
                         <manifestLocation>${project.basedir}/META-INF</manifestLocation>
index ddfbcde3da144de58f489f744dd6a2ef3aa1957f..4ad5c2e7897bcc074fe2f756821aa38b0ec36544 100644 (file)
@@ -8,11 +8,14 @@
 
 package org.opendaylight.aaa.sts;
 
+import java.io.IOException;
 import java.util.List;
 import java.util.Map;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ContainerRequestFilter;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
@@ -26,14 +29,11 @@ import org.opendaylight.aaa.api.Authentication;
 import org.opendaylight.aaa.api.AuthenticationException;
 import org.opendaylight.aaa.api.TokenAuth;
 
-import com.sun.jersey.spi.container.ContainerRequest;
-import com.sun.jersey.spi.container.ContainerRequestFilter;
-
 /**
  * A token-based authentication filter for resource providers.
  *
  * @author liemmn
- *
+ * @see javax.ws.rs.ContainerRequestFilter
  */
 public class TokenAuthFilter implements ContainerRequestFilter {
 
@@ -44,55 +44,6 @@ public class TokenAuthFilter implements ContainerRequestFilter {
     @Context
     private HttpServletRequest httpRequest;
 
-    @Override
-    public ContainerRequest filter(ContainerRequest request) {
-
-        // Do the CORS check first
-       if(checkCORSOptionRequest(request)) {
-           return request;
-       }
-
-        // Are we up yet?
-        if (ServiceLocator.getInstance().getAuthenticationService() == null) {
-            throw new WebApplicationException(
-                  Response.status(Status.SERVICE_UNAVAILABLE)
-                  .type(MediaType.APPLICATION_JSON)
-                  .entity("{\"error\":\"Authentication service unavailable\"}")
-                  .build());
-        }
-
-        // Are we doing authentication or not?
-        if (ServiceLocator.getInstance().getAuthenticationService().isAuthEnabled()) {
-            Map<String, List<String>> headers = request.getRequestHeaders();
-
-            // Go through and invoke other TokenAuth first...
-            List<TokenAuth> tokenAuthCollection =
-                    ServiceLocator.getInstance().getTokenAuthCollection();
-            for (TokenAuth ta : tokenAuthCollection) {
-                try {
-                    Authentication auth = ta.validate(headers);
-                    if (auth != null) {
-                        ServiceLocator.getInstance().getAuthenticationService().set(auth);
-                        return request;
-                    }
-                } catch (AuthenticationException ae) {
-                    throw unauthorized();
-                }
-            }
-
-            // OK, last chance to validate token...
-            try {
-                OAuthAccessResourceRequest or = new OAuthAccessResourceRequest(
-                        httpRequest, ParameterStyle.HEADER);
-                validate(or.getAccessToken());
-            } catch (OAuthSystemException | OAuthProblemException e) {
-                throw unauthorized();
-            }
-        }
-
-        return request;
-    }
-
     /**
      * CORS access control : when browser sends cross-origin request, it first sends the OPTIONS method
      * with a list of access control request headers, which has a list of custom headers and access control method
@@ -101,16 +52,10 @@ public class TokenAuthFilter implements ContainerRequestFilter {
      * We should not do any authorization against such request.
      * for more details : https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS
      */
-
-    private boolean checkCORSOptionRequest(ContainerRequest request) {
+    private boolean checkCORSOptionRequest(ContainerRequestContext request) {
         if(OPTIONS.equals(request.getMethod())) {
-            List<String> headerList = request.getRequestHeader(ACCESS_CONTROL_REQUEST_HEADERS);
-            if(headerList != null && !headerList.isEmpty()) {
-                String header = headerList.get(0);
-                if (header != null && header.toLowerCase().contains(AUTHORIZATION)) {
-                    return true;
-                }
-            }
+            String headerString = request.getHeaderString(ACCESS_CONTROL_REQUEST_HEADERS);
+            return headerString.toLowerCase().contains(AUTHORIZATION);
         }
         return false;
     }
@@ -145,4 +90,48 @@ public class TokenAuthFilter implements ContainerRequestFilter {
             super(response);
         }
     }
+
+    @Override
+    public void filter(ContainerRequestContext request) throws IOException {
+        // Do the CORS check first
+        if(checkCORSOptionRequest(request)) {
+            return;
+        }
+        // Are we up yet?
+        if (ServiceLocator.getInstance().getAuthenticationService() == null) {
+            throw new WebApplicationException(
+                    Response.status(Status.SERVICE_UNAVAILABLE)
+                            .type(MediaType.APPLICATION_JSON)
+                            .entity("{\"error\":\"Authentication service unavailable\"}")
+                            .build());
+        }
+
+        // Are we doing authentication or not?
+        if (ServiceLocator.getInstance().getAuthenticationService().isAuthEnabled()) {
+            Map<String, List<String>> headers = request.getHeaders();
+            // Go through and invoke other TokenAuth first...
+            for (TokenAuth ta : ServiceLocator.getInstance().getTokenAuthCollection()) {
+               try {
+                   Authentication auth = ta.validate(headers);
+                   if (auth != null) {
+                       ServiceLocator.getInstance().getAuthenticationService().set(auth);
+                       return;
+                   }
+                } catch (AuthenticationException ae) {
+                   request.abortWith(Response.status(Response.Status.UNAUTHORIZED).entity("User cannot access the resource.").build());
+               }
+            }
+
+            // OK, last chance to validate token...
+            try {
+               OAuthAccessResourceRequest or = new OAuthAccessResourceRequest(
+                    httpRequest, ParameterStyle.HEADER);
+                validate(or.getAccessToken());
+                return;
+            } catch (OAuthSystemException | OAuthProblemException e) {
+                request.abortWith(Response.status(Response.Status.UNAUTHORIZED).entity("User cannot access the resource.").build());
+            }
+            request.abortWith(Response.status(Response.Status.UNAUTHORIZED).entity("User cannot access the resource.").build());
+       }
+    }
 }
index 3e356ac3408c6b0ba878d7561ef0f653c58ce70f..1d7c45d1e6e9e97990fbd63115a799b86ff28874 100644 (file)
@@ -9,12 +9,22 @@
 package org.opendaylight.aaa.sts;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.assertNotNull;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 import static org.mockito.Matchers.anyMap;
 
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Response;
+
+import org.glassfish.jersey.server.ResourceConfig;
+import org.glassfish.jersey.servlet.ServletContainer;
+import org.glassfish.jersey.test.DeploymentContext;
+import org.glassfish.jersey.test.JerseyTest;
+import org.glassfish.jersey.test.ServletDeploymentContext;
+import org.glassfish.jersey.test.grizzly.GrizzlyWebTestContainerFactory;
+import org.glassfish.jersey.test.spi.TestContainerFactory;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.opendaylight.aaa.AuthenticationBuilder;
@@ -23,19 +33,9 @@ import org.opendaylight.aaa.api.Authentication;
 import org.opendaylight.aaa.api.AuthenticationService;
 import org.opendaylight.aaa.api.TokenAuth;
 import org.opendaylight.aaa.api.TokenStore;
-import org.opendaylight.aaa.sts.TokenAuthFilter.UnauthorizedException;
-
-import com.sun.jersey.api.client.ClientResponse;
-import com.sun.jersey.api.client.UniformInterfaceException;
-import com.sun.jersey.test.framework.JerseyTest;
-import com.sun.jersey.test.framework.WebAppDescriptor;
 
 public class TokenAuthTest extends JerseyTest {
 
-    private static final String RS_PACKAGES = "org.opendaylight.aaa.sts";
-    private static final String JERSEY_FILTERS = "com.sun.jersey.spi.container.ContainerRequestFilters";
-    private static final String AUTH_FILTERS = TokenAuthFilter.class.getName();
-
     private static Authentication auth = new AuthenticationBuilder(new ClaimBuilder()
             .setUserId("1234").setUser("Bob").addRole("admin").addRole("user")
             .setDomain("tenantX").build())
@@ -44,9 +44,31 @@ public class TokenAuthTest extends JerseyTest {
     private static final String GOOD_TOKEN = "9b01b7cf-8a49-346d-8c47-6a61193e2b60";
     private static final String BAD_TOKEN = "9b01b7cf-8a49-346d-8c47-6a611badbeef";
 
-    public TokenAuthTest() throws Exception {
-        super(new WebAppDescriptor.Builder(RS_PACKAGES).initParam(
-                JERSEY_FILTERS, AUTH_FILTERS).build());
+    public TokenAuthTest() {
+    }
+
+    @Path("/test")
+    public static class JerseySpringResource {
+        @GET
+        @Path("/ok")
+        public Response getOk()
+        {
+            return Response.ok().build();
+        }
+    }
+
+    @Override
+    protected DeploymentContext configureDeployment() {
+        ResourceConfig resourceConfig = new ResourceConfig();
+        resourceConfig.register(JerseySpringResource.class);
+        resourceConfig.register(TokenAuthFilter.class);
+        return ServletDeploymentContext.forServlet(
+                new ServletContainer(resourceConfig)).build();
+    }
+
+    @Override
+    protected TestContainerFactory getTestContainerFactory() {
+        return new GrizzlyWebTestContainerFactory();
     }
 
     @BeforeClass
@@ -59,26 +81,13 @@ public class TokenAuthTest extends JerseyTest {
                 Boolean.TRUE);
     }
 
-    @Test()
-    public void testGetUnauthorized() {
-        try {
-            resource().path("test").get(String.class);
-            fail("Shoulda failed with 401!");
-        } catch (UniformInterfaceException e) {
-            ClientResponse resp = e.getResponse();
-            assertEquals(401, resp.getStatus());
-            assertTrue(resp.getHeaders()
-                    .get(UnauthorizedException.WWW_AUTHENTICATE)
-                    .contains(UnauthorizedException.OPENDAYLIGHT));
-        }
-    }
-
     @Test
-    public void testGet() {
-        String resp = resource().path("test")
-                .header("Authorization", "Bearer " + GOOD_TOKEN)
-                .get(String.class);
-        assertEquals("ok", resp);
+    public void testGetUnauthorized() {
+        Response resp = target("test/ok")
+                .request()
+                .get();
+        assertNotNull(resp);
+        assertEquals(401, resp.getStatus());
     }
 
     @SuppressWarnings("unchecked")
@@ -89,7 +98,11 @@ public class TokenAuthTest extends JerseyTest {
             TokenAuth ta = mock(TokenAuth.class);
             when(ta.validate(anyMap())).thenReturn(auth);
             ServiceLocator.getInstance().getTokenAuthCollection().add(ta);
-            testGet();
+            Response resp = target("test/ok")
+                    .request()
+                    .header("Authorization", "Bearer " + GOOD_TOKEN)
+                    .get();
+            assertEquals(Response.Status.Family.SUCCESSFUL, resp.getStatusInfo().getFamily());
         } finally {
             ServiceLocator.getInstance().getTokenAuthCollection().clear();
         }
index aa70c42debea98878af0194d8a2ca87950ab2a19..afd5e3ff94af2c997098844f5456d4488d2b210f 100644 (file)
@@ -31,7 +31,7 @@
             <artifactId>slf4j-api</artifactId>
         </dependency>
         <dependency>
-            <groupId>com.sun.jersey</groupId>
+            <groupId>org.glassfish.jersey.core</groupId>
             <artifactId>jersey-server</artifactId>
             <scope>provided</scope>
         </dependency>
index f5c05f052ebc7f4037f6b05a2112755067972dee..f6e6ae4510866a4df2e04c59c985dc7d7540c547 100644 (file)
             <artifactId>slf4j-api</artifactId>
         </dependency>
         <dependency>
-            <groupId>com.sun.jersey</groupId>
+            <groupId>org.glassfish.jersey.core</groupId>
             <artifactId>jersey-server</artifactId>
             <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>javax.servlet</groupId>
-            <artifactId>servlet-api</artifactId>
+            <artifactId>javax.servlet-api</artifactId>
             <scope>provided</scope>
         </dependency>
+        <dependency>
+            <groupId>org.eclipse.persistence</groupId>
+            <artifactId>org.eclipse.persistence.moxy</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.apache.felix</groupId>
             <artifactId>org.apache.felix.dependencymanager</artifactId>
@@ -90,8 +94,8 @@
         </dependency>
         <!-- Testing Dependencies -->
         <dependency>
-            <groupId>com.sun.jersey.jersey-test-framework</groupId>
-            <artifactId>jersey-test-framework-grizzly2</artifactId>
+            <groupId>org.glassfish.jersey.test-framework.providers</groupId>
+            <artifactId>jersey-test-framework-provider-grizzly2</artifactId>
             <scope>test</scope>
         </dependency>
         <dependency>
                 <extensions>true</extensions>
                 <configuration>
                     <instructions>
-                        <Import-Package>javax.servlet.http,javax.ws.rs,javax.ws.rs.core,javax.xml.bind.annotation,org.apache.felix.dm,org.opendaylight.aaa,org.opendaylight.aaa.api,org.osgi.framework,org.slf4j,org.eclipse.jetty.servlets,com.sun.jersey.spi.container.servlet,com.google.*</Import-Package>
+                        <Import-Package>
+                            javax.servlet.http,
+                            javax.ws.rs,
+                            javax.ws.rs.core,
+                            javax.xml.bind.annotation,
+                            org.apache.felix.dm,
+                            org.opendaylight.aaa,
+                            org.opendaylight.aaa.api,
+                            org.osgi.framework,
+                            org.slf4j,
+                            org.eclipse.jetty.servlets
+                        </Import-Package>
                         <Private-Package>org.h2.*</Private-Package>
                         <Embed-Dependency>h2</Embed-Dependency>
                         <Web-ContextPath>/auth</Web-ContextPath>
index b6793b493aa3f03db7ffd2037cbe01fcde4364d5..f622e3fc03de432153882c103fa61f621d5bd7b8 100644 (file)
@@ -19,6 +19,7 @@ import org.slf4j.LoggerFactory;
 
 import javax.ws.rs.core.Application;
 
+import org.eclipse.persistence.jaxb.rs.MOXyJsonProvider;
 import org.opendaylight.aaa.idm.rest.DomainHandler;
 import org.opendaylight.aaa.idm.rest.RoleHandler;
 import org.opendaylight.aaa.idm.rest.UserHandler;
@@ -66,7 +67,8 @@ public class IdmLightApplication extends Application {
 
     @Override
     public Set<Class<?>> getClasses() {
-        return new HashSet<Class<?>>(Arrays.asList(VersionHandler.class,
+        return new HashSet<Class<?>>(Arrays.asList(MOXyJsonProvider.class,
+                                                   VersionHandler.class,
                                                    DomainHandler.class,
                                                    RoleHandler.class,
                                                    UserHandler.class));
index a86497724bf46d7f41cf99dcf20c61f63e8a87c0..19363ed40aad78d5b60ff56725e16478d9322ecf 100644 (file)
@@ -5,17 +5,14 @@
 
     <servlet>
         <servlet-name>IdmLight</servlet-name>
-        <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
+        <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
         <init-param>
             <param-name>javax.ws.rs.Application</param-name>
             <param-value>org.opendaylight.aaa.idm.IdmLightApplication</param-value>
         </init-param>
         <init-param>
-           <param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name><param-value>true</param-value>
-        </init-param>
-        <init-param>
-            <param-name>com.sun.jersey.spi.container.ContainerRequestFilters</param-name>
-            <param-value> org.opendaylight.aaa.sts.TokenAuthFilter</param-value>
+            <param-name>javax.ws.rs.container.ContainerRequestFilter</param-name>
+            <param-value>org.opendaylight.aaa.sts.TokenAuthFilter</param-value>
         </init-param>
         <load-on-startup>1</load-on-startup>
     </servlet>
index be646c1c2aefddce108b602adebc4d804056a651..c2ecb61daffad3da5f5af86dbe401b9e861630df 100644 (file)
@@ -42,7 +42,7 @@
     </dependency>
     <dependency>
       <groupId>javax.servlet</groupId>
-      <artifactId>servlet-api</artifactId>
+      <artifactId>javax.servlet-api</artifactId>
     </dependency>
     <dependency>
       <groupId>com.google.guava</groupId>
index 3d3f4b82f5afacd9de60c20edde2cb998cf29907..8c983fbf81cb8df79e5ba982cbab4db6f10f63c1 100644 (file)
     <dependencies>
         <!-- odl-aaa-authn -->
         <dependency>
-            <groupId>com.sun.jersey</groupId>
-            <artifactId>jersey-servlet</artifactId>
+            <groupId>org.glassfish.jersey.core</groupId>
+            <artifactId>jersey-server</artifactId>
         </dependency>
         <dependency>
-            <groupId>com.sun.jersey</groupId>
-            <artifactId>jersey-core</artifactId>
+            <groupId>org.glassfish.jersey.core</groupId>
+            <artifactId>jersey-common</artifactId>
         </dependency>
         <dependency>
-            <groupId>com.sun.jersey</groupId>
-            <artifactId>jersey-server</artifactId>
+            <groupId>com.eclipsesource.jaxrs</groupId>
+            <artifactId>jersey-all</artifactId>
+        </dependency>
+       <dependency>
+            <groupId>org.glassfish.jersey.containers</groupId>
+            <artifactId>jersey-container-servlet</artifactId>
         </dependency>
         <dependency>
-            <groupId>com.sun.jersey</groupId>
-            <artifactId>jersey-json</artifactId>
+            <groupId>org.glassfish</groupId>
+            <artifactId>javax.json</artifactId>
         </dependency>
         <dependency>
             <groupId>org.apache.felix</groupId>
             <groupId>org.json</groupId>
             <artifactId>json</artifactId>
         </dependency>
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>javax.servlet-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>javax.ws.rs</groupId>
+            <artifactId>javax.ws.rs-api</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.glassfish</groupId>
             <artifactId>javax.json</artifactId>
index d4516d354c69c234eeeed3e770516fc08620695e..555963564610d83bb9188f41882c3d566b7ace6e 100644 (file)
 
         <!-- REST -->
         <feature>war</feature>
-        <bundle>mvn:com.sun.jersey/jersey-servlet/{{VERSION}}</bundle>
-        <bundle>mvn:com.sun.jersey/jersey-core/{{VERSION}}</bundle>
-        <bundle>mvn:com.sun.jersey/jersey-server/{{VERSION}}</bundle>
+        <bundle>mvn:org.glassfish.jersey.bundles.repackaged/jersey-guava/{{VERSION}}</bundle>
+        <bundle>mvn:javax.ws.rs/javax.ws.rs-api/{{VERSION}}</bundle>
+        <bundle>mvn:com.eclipsesource.jaxrs/jersey-all/{{VERSION}}</bundle>
+        <bundle>mvn:javax.servlet/javax.servlet-api/{{VERSION}}</bundle>
+        <bundle>mvn:org.glassfish.jersey.containers/jersey-container-servlet/{{VERSION}}</bundle>
 
         <!-- OSGi -->
         <bundle>mvn:org.apache.felix/org.apache.felix.dependencymanager/{{VERSION}}</bundle>
         <feature version='${controller.mdsal.version}'>odl-mdsal-broker</feature>
         <feature version='${config.version}'>odl-config-core</feature>
 
-
         <!-- OSGi -->
         <bundle>mvn:org.apache.felix/org.apache.felix.dependencymanager/{{VERSION}}</bundle>
         <bundle>mvn:org.apache.felix/org.apache.felix.metatype/{{VERSION}}</bundle>
 
+        <!-- REST -->
+        <feature>war</feature>
+        <bundle>mvn:org.glassfish.jersey.bundles.repackaged/jersey-guava/{{VERSION}}</bundle>
+        <bundle>mvn:javax.ws.rs/javax.ws.rs-api/{{VERSION}}</bundle>
+        <bundle>mvn:com.eclipsesource.jaxrs/jersey-all/{{VERSION}}</bundle>
+        <bundle>mvn:javax.servlet/javax.servlet-api/{{VERSION}}</bundle>
+        <bundle>mvn:org.glassfish.jersey.containers/jersey-container-servlet/{{VERSION}}</bundle>
+
         <!-- OAuth -->
         <bundle>mvn:org.apache.oltu.oauth2/org.apache.oltu.oauth2.common/{{VERSION}}</bundle>
         <bundle>mvn:org.apache.oltu.oauth2/org.apache.oltu.oauth2.authzserver/{{VERSION}}</bundle>
 
         <!-- Federation -->
         <bundle>mvn:org.opendaylight.aaa/aaa-authn-federation/{{VERSION}}</bundle>
-        <bundle>mvn:org.opendaylight.aaa/aaa-authn-idpmapping/{{VERSION}}</bundle>
-        <bundle>mvn:org.glassfish/javax.json/1.0.4</bundle>
-
-        <!-- REST -->
-        <feature>war</feature>
-        <bundle>mvn:com.sun.jersey/jersey-servlet/{{VERSION}}</bundle>
-        <bundle>mvn:com.sun.jersey/jersey-core/{{VERSION}}</bundle>
-        <bundle>mvn:com.sun.jersey/jersey-server/{{VERSION}}</bundle>
+        <bundle>mvn:org.opendaylight.aaa/aaa-authn-idpmapping/{{VERSION}}</bundle>      
+        <bundle>mvn:org.glassfish/javax.json/{{VERSION}}</bundle>
 
         <configfile finalname="etc/opendaylight/karaf/08-authn-config.xml">mvn:org.opendaylight.aaa/aaa-authn-mdsal-config/{{VERSION}}/xml/config</configfile>
         <configfile finalname="/etc/org.opendaylight.aaa.authn.cfg">mvn:org.opendaylight.aaa/aaa-authn/{{VERSION}}/cfg/config</configfile>
index 4236335999f7e9e5fe8ae2da5c3a505d58297f3e..f1ce2f47f467005e09e5af2753d05287ba39c0f6 100644 (file)
@@ -20,7 +20,7 @@
         <!-- Apache Shiro & Dependencies -->
         <bundle>mvn:org.apache.shiro/shiro-core/1.2.3</bundle>
         <bundle>mvn:org.apache.shiro/shiro-web/1.2.3</bundle>
-        <bundle>wrap:mvn:javax.servlet/servlet-api/2.5</bundle>
+        <bundle>wrap:mvn:javax.servlet/javax.servlet-api/${javax.servlet.api.version}</bundle>
 
         <!-- AAA bundles relating to stand-alone shiro feature -->
         <configfile finalname="/etc/shiro.ini">mvn:org.opendaylight.aaa/aaa-shiro/{{VERSION}}/cfg/configuration</configfile>
index 8b62b34568ccf7bb693fa609b3a3c4dc268e74f3..54e782c9826c13bdc6957abebb83c9ff40278842 100644 (file)
@@ -44,7 +44,6 @@
 
         <!-- AuthN -->
         <glassfish.json.version>1.0.4</glassfish.json.version>
-        <servlet.api.version>2.5</servlet.api.version>
         <ehcache.version>2.8.3</ehcache.version>
         <jta.version>1.1.1</jta.version>
         <oltu.version>1.0.0</oltu.version>
             </dependency>
             <dependency>
                 <groupId>javax.servlet</groupId>
-                <artifactId>servlet-api</artifactId>
-                <version>${servlet.api.version}</version>
+                <artifactId>javax.servlet-api</artifactId>
+                <version>${javax.servlet.api.version}</version>
             </dependency>
             <dependency>
-                <groupId>com.sun.jersey</groupId>
-                <artifactId>jersey-servlet</artifactId>
-                <version>${jersey.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>com.sun.jersey</groupId>
-                <artifactId>jersey-core</artifactId>
-                <version>${jersey.version}</version>
+                <groupId>org.glassfish.jersey.core</groupId>
+                <artifactId>jersey-server</artifactId>
+                <version>${jersey2.version}</version>
             </dependency>
             <dependency>
-                <groupId>com.sun.jersey</groupId>
-                <artifactId>jersey-server</artifactId>
-                <version>${jersey.version}</version>
+                <groupId>org.glassfish.jersey.core</groupId>
+                <artifactId>jersey-common</artifactId>
+                <version>${jersey2.version}</version>
             </dependency>
             <dependency>
-                <groupId>com.sun.jersey</groupId>
+                <groupId>org.glassfish.jersey.core</groupId>
                 <artifactId>jersey-json</artifactId>
-                <version>${jersey.version}</version>
+                <version>${jersey2.version}</version>
             </dependency>
             <dependency>
                 <groupId>org.apache.felix</groupId>
                 <scope>test</scope>
             </dependency>
             <dependency>
-                <groupId>com.sun.jersey.jersey-test-framework</groupId>
-                <artifactId>jersey-test-framework-grizzly2</artifactId>
-                <version>${jersey.version}</version>
+                <groupId>org.glassfish.jersey.test-framework.providers</groupId>
+                <artifactId>jersey-test-framework-provider-grizzly2</artifactId>
+                <version>${jersey2.version}</version>
                 <scope>test</scope>
             </dependency>
             <dependency>