oidc-rp: run it using a local feature model
diff --git a/org.apache.sling.servlets.oidc-rp/.gitignore b/org.apache.sling.servlets.oidc-rp/.gitignore
new file mode 100644
index 0000000..a85248d
--- /dev/null
+++ b/org.apache.sling.servlets.oidc-rp/.gitignore
@@ -0,0 +1 @@
+launcher/
diff --git a/org.apache.sling.servlets.oidc-rp/pom.xml b/org.apache.sling.servlets.oidc-rp/pom.xml
index e2ec172..0e82948 100644
--- a/org.apache.sling.servlets.oidc-rp/pom.xml
+++ b/org.apache.sling.servlets.oidc-rp/pom.xml
@@ -44,11 +44,26 @@
 				<artifactId>bnd-maven-plugin</artifactId>
 			</plugin>
             <plugin>
+               <artifactId>maven-failsafe-plugin</artifactId>
+               <executions>
+                   <execution>
+                       <goals>
+                           <goal>integration-test</goal>
+                           <goal>verify</goal>
+                       </goals>
+                   </execution>
+               </executions>
+               <configuration>
+                   <systemPropertyVariables>
+                       <sling.http.port>${http.port}/</sling.http.port>
+                   </systemPropertyVariables>
+               </configuration>
+            </plugin>
+            <plugin>
                 <groupId>org.apache.sling</groupId>
                 <artifactId>slingfeature-maven-plugin</artifactId>
                 <version>1.6.8</version>
                 <extensions>true</extensions>
-
                 <configuration>
                     <skipAddFeatureDependencies>true</skipAddFeatureDependencies>
                     <framework>
@@ -110,25 +125,86 @@
                     </execution>
                </executions>
             </plugin>
-            <!-- 
+            <!-- reserve network ports for the integration tests -->
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>reserve-network-port</id>
+                        <goals>
+                            <goal>reserve-network-port</goal>
+                        </goals>
+                        <phase>pre-integration-test</phase>
+                        <configuration>
+                            <portNames>
+                                <portName>http.port</portName>
+                            </portNames>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
             <plugin>
                 <artifactId>maven-dependency-plugin</artifactId>
                 <executions>
                     <execution>
                         <id>prepare-feature-launcher</id>
                         <goals>
-                            <goal>get</goal>
-                            <goal>copy</goal>
+                            <goal>unpack</goal>
                         </goals>
                         <phase>package</phase>
                         <configuration>
-                            <artifact>org.apache.sling:org.apache.sling.feature.launcher:\${org.apache.sling.feature.launcher.version}</artifact>
-                            <stripVersion>true</stripVersion>
+                            <artifactItems>
+                                <artifactItem>
+                                    <groupId>org.apache.sling</groupId>
+                                    <artifactId>org.apache.sling.feature.launcher</artifactId>
+                                    <version>1.2.4</version>
+                                    <type>tar.gz</type>
+                                    <!-- remove the version number from the unpacked folder -->
+                                    <fileMappers>
+                                        <org.codehaus.plexus.components.io.filemappers.RegExpFileMapper>
+                                            <pattern>\Qorg.apache.sling.feature.launcher-1.2.4\E</pattern>
+                                            <replacement>org.apache.sling.feature.launcher</replacement>
+                                        </org.codehaus.plexus.components.io.filemappers.RegExpFileMapper>
+                                    </fileMappers>
+                                </artifactItem>
+                            </artifactItems>
                         </configuration>
                     </execution>
                 </executions>
             </plugin>
-             -->
+            <plugin>
+                <groupId>org.apache.sling</groupId>
+                <artifactId>feature-launcher-maven-plugin</artifactId>
+                <version>0.1.4</version>
+                <configuration>
+                    <launches>
+                        <launch>
+                            <id>sling-starter-oak-tar</id>
+                            <feature>
+                                <groupId>${project.groupId}</groupId>
+                                <artifactId>${project.artifactId}</artifactId>
+                                <version>${project.version}</version>
+                                <classifier>app</classifier>
+                                <type>slingosgifeature</type>
+                            </feature>
+                            <launcherArguments>
+                                <frameworkProperties>
+                                    <org.osgi.service.http.port>${http.port}</org.osgi.service.http.port>
+                                </frameworkProperties>
+                            </launcherArguments>
+                        </launch>
+                    </launches>
+                </configuration>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>start</goal>
+                            <goal>stop</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
 		</plugins>
 	</build>
 	<dependencies>
diff --git a/org.apache.sling.servlets.oidc-rp/src/main/features/main.json b/org.apache.sling.servlets.oidc-rp/src/main/features/main.json
new file mode 100644
index 0000000..e84f33d
--- /dev/null
+++ b/org.apache.sling.servlets.oidc-rp/src/main/features/main.json
@@ -0,0 +1,36 @@
+{
+  "bundles": [
+    {
+        "id":"com.nimbusds:oauth2-oidc-sdk:9.35",
+        "start-order": 24
+    },
+    {
+        "id":"com.nimbusds:nimbus-jose-jwt:9.22",
+        "start-order": 24
+    },
+    {
+        "id":"com.nimbusds:content-type:2.2",
+        "start-order": 24
+    },
+    {
+       "id":"com.nimbusds:lang-tag:1.6",
+        "start-order": 24
+    },
+    {
+        "id":"org.apache.servicemix.bundles:org.apache.servicemix.bundles.jcip-annotations:1.0_2",
+        "start-order": 24
+    },
+    {
+        "id":"net.minidev:json-smart:2.4.8",
+        "start-order": 24
+    },
+    {
+        "id":"net.minidev:accessors-smart:2.4.8",
+        "start-order": 24
+     },
+    {
+        "id": "org.apache.sling:org.apache.sling.servlets.oidc-rp:${project.version}",
+        "start-order": 25
+    }
+  ]
+}
\ No newline at end of file
diff --git a/org.apache.sling.servlets.oidc-rp/src/test/java/org/apache/sling/servlets/oidc_rp/AuthorizationCodeFlowIT.java b/org.apache.sling.servlets.oidc-rp/src/test/java/org/apache/sling/servlets/oidc_rp/AuthorizationCodeFlowIT.java
index 57f4b83..2eb9f3a 100644
--- a/org.apache.sling.servlets.oidc-rp/src/test/java/org/apache/sling/servlets/oidc_rp/AuthorizationCodeFlowIT.java
+++ b/org.apache.sling.servlets.oidc-rp/src/test/java/org/apache/sling/servlets/oidc_rp/AuthorizationCodeFlowIT.java
@@ -61,14 +61,13 @@
     @Test
     void accessTokenIsPresentOnSuccessfulLogin() throws Exception {
         int keycloakPort = keycloak.getHttpPort();
+        int slingPort = Integer.getInteger("sling.http.port", 8080);
 
         // two parts
         // - local app on port 8080
         // - keycloak on port 8081
         
-        // TODO - lookup external sling app from a env settting ( and start using maven infrastructure )
-
-        SlingClient sling = SlingClient.Builder.create(URI.create("http://localhost:8080"), "admin", "admin").disableRedirectHandling().build();
+        SlingClient sling = SlingClient.Builder.create(URI.create("http://localhost:" + slingPort), "admin", "admin").disableRedirectHandling().build();
 
         // configure connection to keycloak
         sling.adaptTo(OsgiConsoleClient.class).editConfiguration("org.apache.sling.servlets.oidc_rp.impl.OidcConnectionImpl",null,