start on an openid auth module

git-svn-id: https://svn.apache.org/repos/asf/geronimo/components/jaspi/trunk@678946 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/geronimo-jaspi-openid/pom.xml b/geronimo-jaspi-openid/pom.xml
new file mode 100644
index 0000000..43f2d00
--- /dev/null
+++ b/geronimo-jaspi-openid/pom.xml
@@ -0,0 +1,28 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.geronimo.components</groupId>
+        <artifactId>geronimo-jaspi-parent</artifactId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+
+  <artifactId>geronimo-jaspi-openid</artifactId>
+  <name>geronimo-jaspi-openid</name>
+  <dependencies>
+      <dependency>
+          <groupId>org.apache.geronimo.specs</groupId>
+          <artifactId>geronimo-jaspi_1.0_spec</artifactId>
+      </dependency>
+      <dependency>
+          <groupId>org.openid4java</groupId>
+          <artifactId>openid4java-consumer</artifactId>
+          <version>0.9.5-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+          <groupId>org.apache.geronimo.specs</groupId>
+          <artifactId>geronimo-servlet_3.0_spec</artifactId>
+          <version>1.0-EA-SNAPSHOT</version>
+      </dependency>
+  </dependencies>
+</project>
diff --git a/geronimo-jaspi-openid/src/main/java/org/apache/geronimo/components/jaspi/modules/openid/AuthenticatedPrincipal.java b/geronimo-jaspi-openid/src/main/java/org/apache/geronimo/components/jaspi/modules/openid/AuthenticatedPrincipal.java
new file mode 100644
index 0000000..d5ba586
--- /dev/null
+++ b/geronimo-jaspi-openid/src/main/java/org/apache/geronimo/components/jaspi/modules/openid/AuthenticatedPrincipal.java
@@ -0,0 +1,32 @@
+/*
+ * 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.geronimo.components.jaspi.modules.openid;
+
+import java.security.Principal;
+
+/**
+ * @version $Rev:$ $Date:$
+ */
+public class AuthenticatedPrincipal implements Principal {
+    public String getName() {
+        return "authenticated";
+    }
+}
diff --git a/geronimo-jaspi-openid/src/main/java/org/apache/geronimo/components/jaspi/modules/openid/IdentifierPrincipal.java b/geronimo-jaspi-openid/src/main/java/org/apache/geronimo/components/jaspi/modules/openid/IdentifierPrincipal.java
new file mode 100644
index 0000000..e23b71d
--- /dev/null
+++ b/geronimo-jaspi-openid/src/main/java/org/apache/geronimo/components/jaspi/modules/openid/IdentifierPrincipal.java
@@ -0,0 +1,38 @@
+/*
+ * 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.geronimo.components.jaspi.modules.openid;
+
+import java.security.Principal;
+
+/**
+ * @version $Rev:$ $Date:$
+ */
+public class IdentifierPrincipal implements Principal {
+
+    private final String name;
+    public IdentifierPrincipal(String identifier) {
+        name = identifier;
+    }
+
+    public String getName() {
+        return name;
+    }
+}
diff --git a/geronimo-jaspi-openid/src/main/java/org/apache/geronimo/components/jaspi/modules/openid/OpenIDServerAuthModule.java b/geronimo-jaspi-openid/src/main/java/org/apache/geronimo/components/jaspi/modules/openid/OpenIDServerAuthModule.java
new file mode 100644
index 0000000..a258759
--- /dev/null
+++ b/geronimo-jaspi-openid/src/main/java/org/apache/geronimo/components/jaspi/modules/openid/OpenIDServerAuthModule.java
@@ -0,0 +1,214 @@
+/*
+ * 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.geronimo.components.jaspi.modules.openid;
+
+import java.util.Map;
+import java.util.List;
+import java.io.IOException;
+
+import javax.security.auth.message.module.ServerAuthModule;
+import javax.security.auth.message.MessagePolicy;
+import javax.security.auth.message.AuthException;
+import javax.security.auth.message.MessageInfo;
+import javax.security.auth.message.AuthStatus;
+import javax.security.auth.message.callback.CallerPrincipalCallback;
+import javax.security.auth.message.callback.GroupPrincipalCallback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.UnsupportedCallbackException;
+import javax.security.auth.Subject;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.openid4java.consumer.ConsumerManager;
+import org.openid4java.consumer.ConsumerException;
+import org.openid4java.consumer.InMemoryConsumerAssociationStore;
+import org.openid4java.consumer.InMemoryNonceVerifier;
+import org.openid4java.consumer.VerificationResult;
+import org.openid4java.discovery.DiscoveryException;
+import org.openid4java.discovery.DiscoveryInformation;
+import org.openid4java.discovery.Identifier;
+import org.openid4java.message.MessageException;
+import org.openid4java.message.AuthRequest;
+import org.openid4java.message.ParameterList;
+
+/**
+ * @version $Rev:$ $Date:$
+ */
+public class OpenIDServerAuthModule implements ServerAuthModule {
+
+    private static final Class[] SUPPORTED_MESSAGE_TYPES = new Class[] {HttpServletRequest.class, HttpServletResponse.class};
+    public static final String MANDATORY_KEY = "javax.security.auth.message.MessagePolicy.isMandatory";
+    public static final String AUTH_METHOD_KEY = "javax.servlet.http.authType";
+    private static final String OPENID_IDENTIFIER = "openid_identifier";
+    private static final String DISCOVERY_SESSION_KEY = "openid-disc";
+    private static final String RETURN_ADDRESS = "/_openid_security_check";
+    private static final String ORIGINAL_URI_KEY = "org.apache.geronimo.components.jaspi.openid.URI";
+
+    private CallbackHandler callbackHandler;
+    private ConsumerManager consumerManager;
+    private static final String ID_KEY = "org.apache.geronimo.components.jaspi.openid.ID";
+
+    public Class[] getSupportedMessageTypes() {
+        return SUPPORTED_MESSAGE_TYPES;
+    }
+
+    public void initialize(MessagePolicy requestPolicy, MessagePolicy responsePolicy, CallbackHandler handler, Map options) throws AuthException {
+        this.callbackHandler = callbackHandler;
+        try {
+            consumerManager = new ConsumerManager();
+        } catch (ConsumerException e) {
+            throw (AuthException)new AuthException("Unable to create ConsumerManager").initCause(e);
+        }
+        consumerManager.setAssociations(new InMemoryConsumerAssociationStore());
+        consumerManager.setNonceVerifier(new InMemoryNonceVerifier(5000));
+
+        //??
+        consumerManager.getRealmVerifier().setEnforceRpId(false);
+    }
+
+    public void cleanSubject(MessageInfo messageInfo, Subject subject) throws AuthException {
+    }
+
+    public AuthStatus validateRequest(MessageInfo messageInfo, Subject clientSubject, Subject serviceSubject) throws AuthException {
+        HttpServletRequest request = (HttpServletRequest) messageInfo.getRequestMessage();
+        HttpServletResponse response = (HttpServletResponse) messageInfo.getResponseMessage();
+        HttpSession session = request.getSession(isMandatory(messageInfo));
+        //auth not mandatory and not logged in.
+        if (session == null) {
+            return AuthStatus.SUCCESS;
+        }
+        String uri = request.getPathInfo();
+
+        //are we returning from the OP redirect?
+        if (uri.endsWith(RETURN_ADDRESS)) {
+            ParameterList parameterList = new ParameterList(request.getParameterMap());
+            DiscoveryInformation discovered = (DiscoveryInformation) session.getAttribute(DISCOVERY_SESSION_KEY);
+            //TODO what if its missing?
+            String originalURI = (String) session.getAttribute(ORIGINAL_URI_KEY);
+            try {
+                //TODO is originalURI correct for verify call???
+                VerificationResult verification = consumerManager.verify(originalURI, parameterList, discovered);
+                Identifier identifier = verification.getVerifiedId();
+                session.setAttribute(ID_KEY, identifier);
+                //redirect back to original page
+                session.removeAttribute(ORIGINAL_URI_KEY);
+                response.setContentLength(0);
+                response.sendRedirect(response.encodeRedirectURL(originalURI));
+                return AuthStatus.SEND_CONTINUE;
+//            } catch (MessageException e) {
+//
+//            } catch (DiscoveryException e) {
+//
+//            } catch (AssociationException e) {
+//
+//            } catch (IOException e) {
+            } catch (Exception e) {
+                try {
+                    //TODO redirect to error page or just send error
+                    response.sendError(HttpServletResponse.SC_FORBIDDEN, e.getMessage());
+                } catch (IOException e1) {
+
+                }
+            }
+            return AuthStatus.SEND_FAILURE;
+        }
+
+        //are we already logged in, and not expired?
+        Identifier identifier = (Identifier) session.getAttribute(ID_KEY);
+        if (identifier != null) {
+            //TODO set up subject and callback handler.
+            final IdentifierPrincipal principal = new IdentifierPrincipal(identifier.getIdentifier());
+            clientSubject.getPrincipals().add(principal);
+            clientSubject.getPrincipals().add(new AuthenticatedPrincipal());
+            CallerPrincipalCallback cpCallback = new CallerPrincipalCallback(clientSubject, principal);
+            GroupPrincipalCallback gpCallback = new GroupPrincipalCallback(clientSubject, new String[] {"authenticated"});
+            try {
+                callbackHandler.handle(new Callback[] {cpCallback, gpCallback});
+            } catch (IOException e) {
+
+            } catch (UnsupportedCallbackException e) {
+
+            }
+            return AuthStatus.SUCCESS;
+        }
+
+        //assume not...
+
+        String openidIdentifier = request.getParameter(OPENID_IDENTIFIER);
+        try {
+            List<DiscoveryInformation> discoveries = consumerManager.discover(openidIdentifier);
+            //associate with one OP
+            DiscoveryInformation discovered = consumerManager.associate(discoveries);
+            //save association info in session
+            session.setAttribute(DISCOVERY_SESSION_KEY, discovered);
+
+            AuthRequest authRequest = consumerManager.authenticate(discovered, RETURN_ADDRESS);
+
+            //save original uri in response, to be retrieved after redirect returns
+            session.setAttribute(ORIGINAL_URI_KEY, getFullRequestURI(request).toString());
+
+            //TODO openid 2.0 form redirect
+            response.sendRedirect(authRequest.getDestinationUrl(true));
+            return AuthStatus.SEND_CONTINUE;
+            
+        } catch (DiscoveryException e) {
+            throw (AuthException) new AuthException("Could not authenticate").initCause(e);
+        } catch (ConsumerException e) {
+            throw (AuthException) new AuthException("Could not authenticate").initCause(e);
+        } catch (MessageException e) {
+            throw (AuthException) new AuthException("Could not authenticate").initCause(e);
+        } catch (IOException e) {
+            throw (AuthException) new AuthException("Could not authenticate").initCause(e);
+        }
+
+
+//        return null;
+    }
+
+    private StringBuilder getFullRequestURI(HttpServletRequest request) {
+        StringBuilder builder = new StringBuilder();
+        builder.append(request.getScheme()).append("://");
+        builder.append(request.getServerName()).append(":");
+        builder.append(request.getServerPort());
+        //TODO jetty combines this with the uri and query string.  Can this have query params?
+        builder.append(request.getContextPath());
+        builder.append(request.getPathInfo());
+        if (request.getQueryString() != null && request.getQueryString().length() > 0) {
+            builder.append("?").append(request.getQueryString());
+        }
+        return builder;
+    }
+
+    private boolean isMandatory(MessageInfo messageInfo) {
+        String mandatory = (String) messageInfo.getMap().get(MANDATORY_KEY);
+        if (mandatory == null){
+            return false;
+        }
+        return Boolean.valueOf(mandatory);
+    }
+
+    public AuthStatus secureResponse(MessageInfo messageInfo, Subject serviceSubject) throws AuthException {
+        return AuthStatus.SUCCESS;
+    }
+
+}
diff --git a/geronimo-jaspi/pom.xml b/geronimo-jaspi/pom.xml
index 1dd8f42..4c1d8ee 100644
--- a/geronimo-jaspi/pom.xml
+++ b/geronimo-jaspi/pom.xml
@@ -23,9 +23,9 @@
     <modelVersion>4.0.0</modelVersion>
 
     <parent>
-        <groupId>org.apache.geronimo.genesis.config</groupId>
-        <artifactId>project-config</artifactId>
-        <version>1.4</version>
+        <groupId>org.apache.geronimo.components</groupId>
+        <artifactId>geronimo-jaspi-parent</artifactId>
+        <version>1.0-SNAPSHOT</version>
     </parent>
 
     <groupId>org.apache.geronimo.components</groupId>
@@ -33,22 +33,8 @@
     <version>1.0-SNAPSHOT</version>
     <name>Geronimo JASPI implementation</name>
 
-    <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/geronimo/components/jaspi/trunk</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/geronimo/components/jaspi/trunk</developerConnection>
-        <url>http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk</url>
-    </scm>
 
     <properties>
-        <!--
-        NOTE: Project version, to be used instead of ${pom.version} since that
-              value magically changes when using SNAPSHOT versions.
-
-              This value *must* be kept in sync with the value of the <version>
-              element, and it will need to be changed manually before a release,
-              as the maven-release-plugin will not update this value.
-        -->
-        <version>1.0-SNAPSHOT</version>
 
         <!-- OSGi properties -->
         <geronimo.jaspi.osgi.export>${geronimo.jaspi.osgi.export.pkg}*;version=${version}</geronimo.jaspi.osgi.export>
@@ -57,98 +43,6 @@
         <geronimo.jaspi.osgi.private.pkg/>
     </properties>
 
-    <dependencyManagement>
-        <dependencies>
-            <dependency>
-                <groupId>org.apache.geronimo.specs</groupId>
-                <artifactId>geronimo-jaspi_1.0_spec</artifactId>
-                <version>1.0-SNAPSHOT</version>
-            </dependency>
-
-            <dependency>
-                <groupId>org.apache.xbean</groupId>
-                <artifactId>xbean-reflect</artifactId>
-                <version>3.4.3</version>
-            </dependency>
-
-            <dependency>
-                <groupId>org.apache.xbean</groupId>
-                <artifactId>xbean-reflect</artifactId>
-                <version>3.4.3</version>
-            </dependency>
-
-            <dependency>
-                <groupId>com.envoisolutions.sxc</groupId>
-                <artifactId>sxc-jaxb</artifactId>
-                <version>0.8-SNAPSHOT</version>
-                <exclusions>
-                    <exclusion>
-                        <groupId>stax</groupId>
-                        <artifactId>stax-api</artifactId>
-                    </exclusion>
-                </exclusions>
-            </dependency>
-            <dependency>
-                <groupId>org.codehaus.woodstox</groupId>
-                <artifactId>wstx-asl</artifactId>
-                <version>3.2.0</version>
-            </dependency>
-            <dependency>
-                <groupId>com.sun.xml.bind</groupId>
-                <artifactId>jaxb-impl</artifactId>
-                <version>2.0.5</version>
-                <exclusions>
-                    <exclusion>
-                        <groupId>javax.xml.bind</groupId>
-                        <artifactId>jaxb-api</artifactId>
-                    </exclusion>
-                    <exclusion>
-                        <groupId>javax.xml</groupId>
-                        <artifactId>jsr173</artifactId>
-                    </exclusion>
-                    <exclusion>
-                        <groupId>javax.activation</groupId>
-                        <artifactId>activation</artifactId>
-                    </exclusion>
-                    <exclusion>
-                        <groupId>javax.xml.bind</groupId>
-                        <artifactId>jsr173_api</artifactId>
-                    </exclusion>
-                </exclusions>
-            </dependency>
-            <dependency>
-                <groupId>com.sun.xml.bind</groupId>
-                <artifactId>jaxb-xjc</artifactId>
-                <version>2.0.5</version>
-            </dependency>
-
-            <dependency>
-                <groupId>javax.xml.bind</groupId>
-                <artifactId>jaxb-api</artifactId>
-                <version>2.1</version>
-                <exclusions>
-                    <exclusion>
-                        <groupId>javax.xml.bind</groupId>
-                        <artifactId>jsr173_api</artifactId>
-                    </exclusion>
-                </exclusions>
-            </dependency>
-
-            <dependency>
-                <groupId>org.apache.geronimo.specs</groupId>
-                <artifactId>geronimo-stax-api_1.0_spec</artifactId>
-                <version>1.0.1</version>
-            </dependency>
-            <dependency>
-                <groupId>org.testng</groupId>
-                <artifactId>testng</artifactId>
-                <version>5.8</version>
-                <classifier>jdk15</classifier>
-            </dependency>
-
-
-        </dependencies>
-    </dependencyManagement>
 
     <dependencies>
         <dependency>
@@ -200,46 +94,6 @@
 
     </dependencies>
     <build>
-        <pluginManagement>
-            <plugins>
-                <plugin>
-                    <groupId>org.apache.maven.plugins</groupId>
-                    <artifactId>maven-enforcer-plugin</artifactId>
-                    <version>1.0-alpha-3</version>
-                </plugin>
-
-                <plugin>
-                    <groupId>org.apache.maven.plugins</groupId>
-                    <artifactId>maven-surefire-plugin</artifactId>
-                    <version>2.4.2</version>
-                    <configuration>
-                        <redirectTestOutputToFile>true</redirectTestOutputToFile>
-                    </configuration>
-                </plugin>
-
-                <plugin>
-                    <groupId>org.apache.maven.plugins</groupId>
-                    <artifactId>maven-install-plugin</artifactId>
-                    <version>2.2</version>
-                </plugin>
-
-                <plugin>
-                    <groupId>org.apache.maven.plugins</groupId>
-                    <artifactId>maven-jar-plugin</artifactId>
-                    <version>2.1</version>
-                    <configuration>
-                    </configuration>
-                    <executions>
-                        <execution>
-                            <goals>
-                                <!-- Build *test.jar files for modules -->
-                                <goal>test-jar</goal>
-                            </goals>
-                        </execution>
-                    </executions>
-                </plugin>
-            </plugins>
-        </pluginManagement>
 
         <plugins>
 
@@ -261,71 +115,6 @@
                 <!--</executions>-->
             <!--</plugin>-->
 
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-enforcer-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <phase>validate</phase>
-                        <goals>
-                            <goal>enforce</goal>
-                        </goals>
-                        <configuration>
-                            <rules>
-                                <!-- Allow any Java >= 1.5, but not 1.6 or above -->
-                                <requireJavaVersion>
-                                    <version>[1.5,1.6)</version>
-                                </requireJavaVersion>
-
-                                <!-- Allow any Maven >= 2.0.5 -->
-                                <requireMavenVersion>
-                                    <version>[2.0.9,)</version>
-                                </requireMavenVersion>
-                            </rules>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-
-            <plugin>
-                <groupId>org.apache.geronimo.genesis.plugins</groupId>
-                <artifactId>tools-maven-plugin</artifactId>
-
-                <executions>
-
-                    <execution>
-                        <id>verify-legal-files</id>
-                        <phase>verify</phase>
-                        <goals>
-                            <goal>verify-legal-files</goal>
-                        </goals>
-                        <configuration>
-                            <strict>true</strict>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-compiler-plugin</artifactId>
-                <version>2.0</version>
-                <configuration>
-                    <source>1.5</source>
-                    <target>1.5</target>
-                </configuration>
-            </plugin>
-
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-idea-plugin</artifactId>
-                <version>2.1</version>
-                <configuration>
-                    <jdkName>1.5</jdkName>
-                    <jdkLevel>1.5</jdkLevel>
-                    <linkModules>true</linkModules>
-                </configuration>
-            </plugin>
             <!--
                         <plugin>
                             <groupId>org.apache.felix</groupId>
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..fd5cba6
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,331 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+    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.
+-->
+
+<!-- $Rev$ $Date$ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.geronimo.genesis.config</groupId>
+        <artifactId>project-config</artifactId>
+        <version>1.4</version>
+    </parent>
+
+    <groupId>org.apache.geronimo.components</groupId>
+    <artifactId>geronimo-jaspi-parent</artifactId>
+    <version>1.0-SNAPSHOT</version>
+    <packaging>pom</packaging>
+    <name>Geronimo JASPI implementation</name>
+
+    <scm>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/geronimo/components/jaspi/trunk</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/geronimo/components/jaspi/trunk</developerConnection>
+        <url>http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk</url>
+    </scm>
+
+    <properties>
+        <!--
+        NOTE: Project version, to be used instead of ${pom.version} since that
+              value magically changes when using SNAPSHOT versions.
+
+              This value *must* be kept in sync with the value of the <version>
+              element, and it will need to be changed manually before a release,
+              as the maven-release-plugin will not update this value.
+        -->
+        <version>1.0-SNAPSHOT</version>
+
+        <!-- OSGi properties -->
+        <geronimo.jaspi.osgi.export>${geronimo.jaspi.osgi.export.pkg}*;version=${version}</geronimo.jaspi.osgi.export>
+        <geronimo.jaspi.osgi.export.pkg/>
+        <geronimo.jaspi.osgi.import.pkg/>
+        <geronimo.jaspi.osgi.private.pkg/>
+    </properties>
+
+    <modules>
+        <module>geronimo-jaspi</module>
+        <module>geronimo-jaspi-openid</module>
+    </modules>
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.apache.geronimo.specs</groupId>
+                <artifactId>geronimo-jaspi_1.0_spec</artifactId>
+                <version>1.0-SNAPSHOT</version>
+            </dependency>
+
+            <dependency>
+                <groupId>org.apache.xbean</groupId>
+                <artifactId>xbean-reflect</artifactId>
+                <version>3.4.3</version>
+            </dependency>
+
+            <dependency>
+                <groupId>org.apache.xbean</groupId>
+                <artifactId>xbean-reflect</artifactId>
+                <version>3.4.3</version>
+            </dependency>
+
+            <dependency>
+                <groupId>com.envoisolutions.sxc</groupId>
+                <artifactId>sxc-jaxb</artifactId>
+                <version>0.8-SNAPSHOT</version>
+                <exclusions>
+                    <exclusion>
+                        <groupId>stax</groupId>
+                        <artifactId>stax-api</artifactId>
+                    </exclusion>
+                </exclusions>
+            </dependency>
+            <dependency>
+                <groupId>org.codehaus.woodstox</groupId>
+                <artifactId>wstx-asl</artifactId>
+                <version>3.2.0</version>
+            </dependency>
+            <dependency>
+                <groupId>com.sun.xml.bind</groupId>
+                <artifactId>jaxb-impl</artifactId>
+                <version>2.0.5</version>
+                <exclusions>
+                    <exclusion>
+                        <groupId>javax.xml.bind</groupId>
+                        <artifactId>jaxb-api</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>javax.xml</groupId>
+                        <artifactId>jsr173</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>javax.activation</groupId>
+                        <artifactId>activation</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>javax.xml.bind</groupId>
+                        <artifactId>jsr173_api</artifactId>
+                    </exclusion>
+                </exclusions>
+            </dependency>
+            <dependency>
+                <groupId>com.sun.xml.bind</groupId>
+                <artifactId>jaxb-xjc</artifactId>
+                <version>2.0.5</version>
+            </dependency>
+
+            <dependency>
+                <groupId>javax.xml.bind</groupId>
+                <artifactId>jaxb-api</artifactId>
+                <version>2.1</version>
+                <exclusions>
+                    <exclusion>
+                        <groupId>javax.xml.bind</groupId>
+                        <artifactId>jsr173_api</artifactId>
+                    </exclusion>
+                </exclusions>
+            </dependency>
+
+            <dependency>
+                <groupId>org.apache.geronimo.specs</groupId>
+                <artifactId>geronimo-stax-api_1.0_spec</artifactId>
+                <version>1.0.1</version>
+            </dependency>
+            <dependency>
+                <groupId>org.testng</groupId>
+                <artifactId>testng</artifactId>
+                <version>5.8</version>
+                <classifier>jdk15</classifier>
+            </dependency>
+
+
+        </dependencies>
+    </dependencyManagement>
+
+    <build>
+        <pluginManagement>
+            <plugins>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-enforcer-plugin</artifactId>
+                    <version>1.0-alpha-3</version>
+                </plugin>
+
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-surefire-plugin</artifactId>
+                    <version>2.4.2</version>
+                    <configuration>
+                        <redirectTestOutputToFile>true</redirectTestOutputToFile>
+                    </configuration>
+                </plugin>
+
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-install-plugin</artifactId>
+                    <version>2.2</version>
+                </plugin>
+
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-jar-plugin</artifactId>
+                    <version>2.1</version>
+                    <configuration>
+                    </configuration>
+                    <executions>
+                        <execution>
+                            <goals>
+                                <!-- Build *test.jar files for modules -->
+                                <goal>test-jar</goal>
+                            </goals>
+                        </execution>
+                    </executions>
+                </plugin>
+            </plugins>
+        </pluginManagement>
+
+        <plugins>
+
+            <!--<plugin>-->
+                <!--<groupId>com.envoisolutions.sxc</groupId>-->
+                <!--<artifactId>sxc-jaxb-maven-plugin</artifactId>-->
+                <!--<version>0.8-SNAPSHOT</version>-->
+                <!--<executions>-->
+                    <!--<execution>-->
+                        <!--<configuration>-->
+                            <!--<classes>-->
+                                <!--<class>org.apache.geronimo.components.jaspi.model</class>-->
+                            <!--</classes>-->
+                        <!--</configuration>-->
+                        <!--<goals>-->
+                            <!--<goal>generate</goal>-->
+                        <!--</goals>-->
+                    <!--</execution>-->
+                <!--</executions>-->
+            <!--</plugin>-->
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-enforcer-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <phase>validate</phase>
+                        <goals>
+                            <goal>enforce</goal>
+                        </goals>
+                        <configuration>
+                            <rules>
+                                <!-- Allow any Java >= 1.5, but not 1.6 or above -->
+                                <requireJavaVersion>
+                                    <version>[1.5,1.6)</version>
+                                </requireJavaVersion>
+
+                                <!-- Allow any Maven >= 2.0.5 -->
+                                <requireMavenVersion>
+                                    <version>[2.0.9,)</version>
+                                </requireMavenVersion>
+                            </rules>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+
+            <plugin>
+                <groupId>org.apache.geronimo.genesis.plugins</groupId>
+                <artifactId>tools-maven-plugin</artifactId>
+
+                <executions>
+
+                    <execution>
+                        <id>verify-legal-files</id>
+                        <phase>verify</phase>
+                        <goals>
+                            <goal>verify-legal-files</goal>
+                        </goals>
+                        <configuration>
+                            <strict>true</strict>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>2.0</version>
+                <configuration>
+                    <source>1.5</source>
+                    <target>1.5</target>
+                </configuration>
+            </plugin>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-idea-plugin</artifactId>
+                <version>2.1</version>
+                <configuration>
+                    <jdkName>1.5</jdkName>
+                    <jdkLevel>1.5</jdkLevel>
+                    <linkModules>true</linkModules>
+                </configuration>
+            </plugin>
+            <!--
+                        <plugin>
+                            <groupId>org.apache.felix</groupId>
+                            <artifactId>maven-bundle-plugin</artifactId>
+                            <version>1.2.0</version>
+                            <extensions>true</extensions>
+                            <executions>
+                                <execution>
+                                    <goals>
+                                        <goal>bundle</goal>
+                                    </goals>
+                                </execution>
+                            </executions>
+                            <configuration>
+                                <instructions>
+                                    <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+                                    <Export-Package>${geronimo.jaspi.osgi.export}</Export-Package>
+                                    <Import-Package>${geronimo.jaspi.osgi.import.pkg}*</Import-Package>
+                                    <Private-Package>${geronimo.jaspi.osgi.private.pkg}</Private-Package>
+                                </instructions>
+                                <unpackBundle>true</unpackBundle>
+                            </configuration>
+                        </plugin>
+            -->
+            <!--<plugin>-->
+                <!--<groupId>org.jvnet.jaxb2.maven2</groupId>-->
+                <!--<artifactId>maven-jaxb2-plugin</artifactId>-->
+                <!--<version>0.5</version>-->
+                <!--<executions>-->
+                    <!--<execution>-->
+                        <!--<goals>-->
+                            <!--<goal>generate</goal>-->
+                        <!--</goals>-->
+                    <!--</execution>-->
+                <!--</executions>-->
+                <!--<configuration>-->
+                    <!--<schemaDirectory>src/main/xsd</schemaDirectory>-->
+                    <!--<packageName>org.apache.geronimo.components.jaspi.model</packageName>-->
+                    <!--<extension>true</extension>-->
+                <!--</configuration>-->
+            <!--</plugin>-->
+        </plugins>
+    </build>
+
+</project>
+