geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r684571 - in /geronimo/components/jaspi/trunk: geronimo-jaspi-openid/src/test/java/org/apache/geronimo/components/jaspi/modules/openid/ geronimo-jaspi/ geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ geronimo-jaspi/...
Date Sun, 10 Aug 2008 18:52:08 GMT
Author: djencks
Date: Sun Aug 10 11:52:08 2008
New Revision: 684571

URL: http://svn.apache.org/viewvc?rev=684571&view=rev
Log:
a few tweaks

Modified:
    geronimo/components/jaspi/trunk/geronimo-jaspi-openid/src/test/java/org/apache/geronimo/components/jaspi/modules/openid/OpenIDServerAuthModuleTest.java
    geronimo/components/jaspi/trunk/geronimo-jaspi/pom.xml
    geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/JaspiUtil.java
    geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/JaspiXmlUtil.java
    geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ServerAuthContextType.java
    geronimo/components/jaspi/trunk/geronimo-jaspi/src/test/java/org/apache/geronimo/components/jaspi/AuthConfigFactoryImplTest.java

Modified: geronimo/components/jaspi/trunk/geronimo-jaspi-openid/src/test/java/org/apache/geronimo/components/jaspi/modules/openid/OpenIDServerAuthModuleTest.java
URL: http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk/geronimo-jaspi-openid/src/test/java/org/apache/geronimo/components/jaspi/modules/openid/OpenIDServerAuthModuleTest.java?rev=684571&r1=684570&r2=684571&view=diff
==============================================================================
--- geronimo/components/jaspi/trunk/geronimo-jaspi-openid/src/test/java/org/apache/geronimo/components/jaspi/modules/openid/OpenIDServerAuthModuleTest.java
(original)
+++ geronimo/components/jaspi/trunk/geronimo-jaspi-openid/src/test/java/org/apache/geronimo/components/jaspi/modules/openid/OpenIDServerAuthModuleTest.java
Sun Aug 10 11:52:08 2008
@@ -33,7 +33,7 @@
 import org.testng.annotations.Test;
 
 /**
- * @version $Rev:$ $Date:$
+ * @version $Rev$ $Date$
  */
 public class OpenIDServerAuthModuleTest {
 
@@ -44,7 +44,7 @@
         AuthConfigFactory factory1 = AuthConfigFactory.getFactory();
         AuthModuleType<ServerAuthModule> authModuleType = new AuthModuleType<ServerAuthModule>();
         authModuleType.setClassName(OpenIDServerAuthModule.class.getName());
-        AuthConfigProvider authConfigProvider = JaspiUtil.wrapServerAuthModule("Http", "testApp",
"id", authModuleType, true, new ConstantClassLoaderLookup(getClass().getClassLoader()), callbackHandler);
+        AuthConfigProvider authConfigProvider = JaspiUtil.wrapServerAuthModule("Http", "testApp",
"id", authModuleType, true, new ConstantClassLoaderLookup(getClass().getClassLoader()));
         factory1.registerConfigProvider(authConfigProvider, "Http", "testApp", "description");
         AuthConfigProvider authConfigProvider2 = factory1.getConfigProvider("Http", "testApp",
null);
         ServerAuthConfig serverAuthConfig = authConfigProvider2.getServerAuthConfig("Http",
"testApp", callbackHandler);

Modified: geronimo/components/jaspi/trunk/geronimo-jaspi/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk/geronimo-jaspi/pom.xml?rev=684571&r1=684570&r2=684571&view=diff
==============================================================================
--- geronimo/components/jaspi/trunk/geronimo-jaspi/pom.xml (original)
+++ geronimo/components/jaspi/trunk/geronimo-jaspi/pom.xml Sun Aug 10 11:52:08 2008
@@ -97,6 +97,18 @@
 
         <plugins>
 
+            <plugin>
+              <groupId>org.apache.maven.plugins</groupId>
+              <artifactId>maven-jar-plugin</artifactId>
+              <executions>
+                <execution>
+                  <goals>
+                    <goal>jar</goal>
+                    <goal>test-jar</goal>
+                  </goals>
+                </execution>
+              </executions>
+            </plugin>
             <!--<plugin>-->
                 <!--<groupId>com.envoisolutions.sxc</groupId>-->
                 <!--<artifactId>sxc-jaxb-maven-plugin</artifactId>-->

Modified: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/JaspiUtil.java
URL: http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/JaspiUtil.java?rev=684571&r1=684570&r2=684571&view=diff
==============================================================================
--- geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/JaspiUtil.java
(original)
+++ geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/JaspiUtil.java
Sun Aug 10 11:52:08 2008
@@ -20,56 +20,58 @@
 
 package org.apache.geronimo.components.jaspi.model;
 
-import java.util.Map;
 import java.util.Collections;
+import java.util.Map;
 
-import javax.security.auth.message.config.AuthConfigProvider;
-import javax.security.auth.message.config.ClientAuthConfig;
 import javax.security.auth.message.AuthException;
+import javax.security.auth.message.config.AuthConfigProvider;
 import javax.security.auth.message.module.ClientAuthModule;
 import javax.security.auth.message.module.ServerAuthModule;
-import javax.security.auth.callback.CallbackHandler;
 
 import org.apache.geronimo.components.jaspi.ClassLoaderLookup;
 
 /**
  * Convenience methods to wrap various jaspi objects into AuthConfigProvider instances, ready
to be registered.
- * @version $Rev:$ $Date:$
+ * @version $Rev$ $Date$
  */
 public class JaspiUtil {
 
     private JaspiUtil() {
     }
 
-    public static AuthConfigProvider wrapClientAuthConfig(ClientAuthConfigType clientAuthConfigType,
ClassLoaderLookup classLoaderLookup, CallbackHandler callbackHandler) throws AuthException
{
+    public static AuthConfigProvider wraptAuthConfigProvider(ConfigProviderType configProviderType,
ClassLoaderLookup classLoaderLookup) {
+        return new ConfigProviderType.ConfigProviderImpl(configProviderType.getClientAuthConfig(),
configProviderType.getServerAuthConfig(), classLoaderLookup);
+    }
+
+    public static AuthConfigProvider wrapClientAuthConfig(ClientAuthConfigType clientAuthConfigType,
ClassLoaderLookup classLoaderLookup) throws AuthException {
         Map<String, ClientAuthConfigType> clientAuthConfig = Collections.singletonMap(clientAuthConfigType.getKey(),
clientAuthConfigType);
         return new ConfigProviderType.ConfigProviderImpl(clientAuthConfig, Collections.<String,
ServerAuthConfigType>emptyMap(), classLoaderLookup);
     }
 
-    public static AuthConfigProvider wrapClientAuthContext(ClientAuthContextType clientAuthContextType,
boolean _protected, ClassLoaderLookup classLoaderLookup, CallbackHandler callbackHandler)
throws AuthException {
+    public static AuthConfigProvider wrapClientAuthContext(ClientAuthContextType clientAuthContextType,
boolean _protected, ClassLoaderLookup classLoaderLookup) throws AuthException {
         ClientAuthConfigType clientAuthConfigType = new ClientAuthConfigType(clientAuthContextType,
_protected);
-        return wrapClientAuthConfig(clientAuthConfigType, classLoaderLookup, callbackHandler);
+        return wrapClientAuthConfig(clientAuthConfigType, classLoaderLookup);
     }
 
-    public static AuthConfigProvider wrapClientAuthModule(String messageLayer, String appContext,
String authenticationContextID, AuthModuleType<ClientAuthModule> clientAuthModuleType,
boolean _protected, ClassLoaderLookup classLoaderLookup, CallbackHandler callbackHandler)
throws AuthException {
+    public static AuthConfigProvider wrapClientAuthModule(String messageLayer, String appContext,
String authenticationContextID, AuthModuleType<ClientAuthModule> clientAuthModuleType,
boolean _protected, ClassLoaderLookup classLoaderLookup) throws AuthException {
         ClientAuthContextType clientAuthContextType = new ClientAuthContextType(messageLayer,
appContext, authenticationContextID, clientAuthModuleType);
-        return wrapClientAuthContext(clientAuthContextType, _protected, classLoaderLookup,
callbackHandler);
+        return wrapClientAuthContext(clientAuthContextType, _protected, classLoaderLookup);
     }
 
 
-    public static AuthConfigProvider wrapServerAuthConfig(ServerAuthConfigType serverAuthConfigType,
ClassLoaderLookup classLoaderLookup, CallbackHandler callbackHandler) throws AuthException
{
+    public static AuthConfigProvider wrapServerAuthConfig(ServerAuthConfigType serverAuthConfigType,
ClassLoaderLookup classLoaderLookup) throws AuthException {
         Map<String, ServerAuthConfigType> serverAuthConfig = Collections.singletonMap(serverAuthConfigType.getKey(),
serverAuthConfigType);
         return new ConfigProviderType.ConfigProviderImpl(Collections.<String, ClientAuthConfigType>emptyMap(),
serverAuthConfig, classLoaderLookup);
     }
 
-    public static AuthConfigProvider wrapServerAuthContext(ServerAuthContextType serverAuthContextType,
boolean _protected, ClassLoaderLookup classLoaderLookup, CallbackHandler callbackHandler)
throws AuthException {
+    public static AuthConfigProvider wrapServerAuthContext(ServerAuthContextType serverAuthContextType,
boolean _protected, ClassLoaderLookup classLoaderLookup) throws AuthException {
         ServerAuthConfigType serverAuthConfigType = new ServerAuthConfigType(serverAuthContextType,
_protected);
-        return wrapServerAuthConfig(serverAuthConfigType, classLoaderLookup, callbackHandler);
+        return wrapServerAuthConfig(serverAuthConfigType, classLoaderLookup);
     }
 
-    public static AuthConfigProvider wrapServerAuthModule(String messageLayer, String appContext,
String authenticationContextID, AuthModuleType<ServerAuthModule> serverAuthModuleType,
boolean _protected, ClassLoaderLookup classLoaderLookup, CallbackHandler callbackHandler)
throws AuthException {
+    public static AuthConfigProvider wrapServerAuthModule(String messageLayer, String appContext,
String authenticationContextID, AuthModuleType<ServerAuthModule> serverAuthModuleType,
boolean _protected, ClassLoaderLookup classLoaderLookup) throws AuthException {
         ServerAuthContextType serverAuthContextType = new ServerAuthContextType(messageLayer,
appContext, authenticationContextID, serverAuthModuleType);
-        return wrapServerAuthContext(serverAuthContextType, _protected, classLoaderLookup,
callbackHandler);
+        return wrapServerAuthContext(serverAuthContextType, _protected, classLoaderLookup);
     }
 
 }

Modified: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/JaspiXmlUtil.java
URL: http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/JaspiXmlUtil.java?rev=684571&r1=684570&r2=684571&view=diff
==============================================================================
--- geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/JaspiXmlUtil.java
(original)
+++ geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/JaspiXmlUtil.java
Sun Aug 10 11:52:08 2008
@@ -35,6 +35,8 @@
 import javax.xml.bind.Unmarshaller;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.message.module.ServerAuthModule;
+import javax.security.auth.message.module.ClientAuthModule;
 
 import org.xml.sax.SAXException;
 import org.apache.geronimo.components.jaspi.ClassLoaderLookup;
@@ -71,7 +73,20 @@
 
     public static <T>T load(Reader in, Class<T> clazz) throws ParserConfigurationException,
IOException, SAXException, JAXBException, XMLStreamException {
         XMLStreamReader xmlStream = XMLINPUT_FACTORY.createXMLStreamReader(in);
-        return load(xmlStream, clazz);
+        try {
+            return load(xmlStream, clazz);
+        } finally {
+            xmlStream.close();
+        }
+    }
+
+    public static Object untypedLoad(Reader in) throws ParserConfigurationException, IOException,
SAXException, JAXBException, XMLStreamException {
+        XMLStreamReader xmlStream = XMLINPUT_FACTORY.createXMLStreamReader(in);
+        try {
+            return untypedLoad(xmlStream);
+        } finally {
+            xmlStream.close();
+        }
     }
 
     public static <T>T load(XMLStreamReader in, Class<T> clazz) throws ParserConfigurationException,
IOException, SAXException, JAXBException, XMLStreamException {
@@ -80,6 +95,11 @@
         return element.getValue();
     }
 
+    public static Object untypedLoad(XMLStreamReader in) throws ParserConfigurationException,
IOException, SAXException, JAXBException, XMLStreamException {
+        Unmarshaller unmarshaller = JASPI_CONTEXT.createUnmarshaller();
+        return unmarshaller.unmarshal(in);
+    }
+
     public static void writeJaspi(JaspiType metadata, Writer out) throws XMLStreamException,
JAXBException {
         write(new ObjectFactory().createJaspi(metadata), out);
     }
@@ -135,11 +155,11 @@
         write(new ObjectFactory().createClientAuthModule(metadata), out);
     }
 
-    public static AuthModuleType loadClientAuthModule(Reader in) throws ParserConfigurationException,
IOException, SAXException, JAXBException, XMLStreamException {
+    public static AuthModuleType<ClientAuthModule> loadClientAuthModule(Reader in)
throws ParserConfigurationException, IOException, SAXException, JAXBException, XMLStreamException
{
         return load(in, AuthModuleType.class);
     }
 
-    public static AuthModuleType loadClientAuthModule(XMLStreamReader in) throws ParserConfigurationException,
IOException, SAXException, JAXBException, XMLStreamException {
+    public static AuthModuleType<ClientAuthModule> loadClientAuthModule(XMLStreamReader
in) throws ParserConfigurationException, IOException, SAXException, JAXBException, XMLStreamException
{
         return load(in, AuthModuleType.class);
     }
 
@@ -175,11 +195,11 @@
         write(new ObjectFactory().createServerAuthModule(metadata), out);
     }
 
-    public static AuthModuleType loadServerAuthModule(Reader in) throws ParserConfigurationException,
IOException, SAXException, JAXBException, XMLStreamException {
+    public static AuthModuleType<ServerAuthModule> loadServerAuthModule(Reader in)
throws ParserConfigurationException, IOException, SAXException, JAXBException, XMLStreamException
{
         return load(in, AuthModuleType.class);
     }
 
-    public static AuthModuleType loadServerAuthModule(XMLStreamReader in) throws ParserConfigurationException,
IOException, SAXException, JAXBException, XMLStreamException {
+    public static AuthModuleType<ServerAuthModule> loadServerAuthModule(XMLStreamReader
in) throws ParserConfigurationException, IOException, SAXException, JAXBException, XMLStreamException
{
         return load(in, AuthModuleType.class);
     }
 

Modified: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ServerAuthContextType.java
URL: http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ServerAuthContextType.java?rev=684571&r1=684570&r2=684571&view=diff
==============================================================================
--- geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ServerAuthContextType.java
(original)
+++ geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ServerAuthContextType.java
Sun Aug 10 11:52:08 2008
@@ -256,7 +256,7 @@
                 if (result == AuthStatus.SEND_CONTINUE || result == AuthStatus.SEND_FAILURE)
{
                     return result;
                 }
-                throw new AuthException("Invalid AuthStatus " + result + " from server auth
module: " + serverAuthModule);
+                throw new AuthException("Invalid AuthStatus " + result + " from server auth
module secureResponse: " + serverAuthModule);
             }
             return AuthStatus.SEND_SUCCESS;
         }
@@ -272,7 +272,7 @@
                 if (result == AuthStatus.SEND_SUCCESS || result == AuthStatus.SEND_CONTINUE
|| result == AuthStatus.FAILURE) {
                     return result;
                 }
-                throw new AuthException("Invalid AuthStatus " + result + " from server auth
module: " + serverAuthModule);
+                throw new AuthException("Invalid AuthStatus " + result + " from server auth
module validateRequest: " + serverAuthModule);
             }
             return AuthStatus.SUCCESS;
         }

Modified: geronimo/components/jaspi/trunk/geronimo-jaspi/src/test/java/org/apache/geronimo/components/jaspi/AuthConfigFactoryImplTest.java
URL: http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk/geronimo-jaspi/src/test/java/org/apache/geronimo/components/jaspi/AuthConfigFactoryImplTest.java?rev=684571&r1=684570&r2=684571&view=diff
==============================================================================
--- geronimo/components/jaspi/trunk/geronimo-jaspi/src/test/java/org/apache/geronimo/components/jaspi/AuthConfigFactoryImplTest.java
(original)
+++ geronimo/components/jaspi/trunk/geronimo-jaspi/src/test/java/org/apache/geronimo/components/jaspi/AuthConfigFactoryImplTest.java
Sun Aug 10 11:52:08 2008
@@ -19,24 +19,23 @@
 import java.io.File;
 import java.net.URL;
 
+import javax.security.auth.callback.CallbackHandler;
 import javax.security.auth.message.AuthException;
-import javax.security.auth.message.module.ClientAuthModule;
-import javax.security.auth.message.module.ServerAuthModule;
 import javax.security.auth.message.config.AuthConfigFactory;
-import javax.security.auth.message.config.RegistrationListener;
-import javax.security.auth.message.config.AuthConfigProvider;
 import javax.security.auth.message.config.AuthConfigFactory.RegistrationContext;
-import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.message.config.AuthConfigProvider;
+import javax.security.auth.message.config.RegistrationListener;
+import javax.security.auth.message.module.ClientAuthModule;
+import javax.security.auth.message.module.ServerAuthModule;
 
 import junit.framework.TestCase;
-
+import org.apache.geronimo.components.jaspi.model.AuthModuleType;
+import org.apache.geronimo.components.jaspi.model.JaspiUtil;
 import org.apache.geronimo.components.jaspi.providers.BadConstructorProvider;
 import org.apache.geronimo.components.jaspi.providers.BadImplementProvider;
-import org.apache.geronimo.components.jaspi.providers.DummyProvider;
 import org.apache.geronimo.components.jaspi.providers.DummyClientAuthModule;
+import org.apache.geronimo.components.jaspi.providers.DummyProvider;
 import org.apache.geronimo.components.jaspi.providers.DummyServerAuthModule;
-import org.apache.geronimo.components.jaspi.model.AuthModuleType;
-import org.apache.geronimo.components.jaspi.model.JaspiUtil;
 
 public class AuthConfigFactoryImplTest extends TestCase {
 
@@ -162,7 +161,7 @@
         AuthModuleType<ClientAuthModule> authModuleType = new AuthModuleType<ClientAuthModule>();
         authModuleType.setClassName(DummyClientAuthModule.class.getName());
         ClassLoaderLookup classLoaderLookup = new ConstantClassLoaderLookup(getClass().getClassLoader());
-        AuthConfigProvider authConfigProvider = JaspiUtil.wrapClientAuthModule("layer", "appContext1",
"id", authModuleType, true, classLoaderLookup, null);
+        AuthConfigProvider authConfigProvider = JaspiUtil.wrapClientAuthModule("layer", "appContext1",
"id", authModuleType, true, classLoaderLookup);
         String regId = factory.registerConfigProvider(authConfigProvider, "layer", "appContext1",
"description");
         DummyListener listener = new DummyListener();
         assertNotNull(factory.getConfigProvider("layer", "appContext1", listener));
@@ -175,7 +174,7 @@
         AuthModuleType<ServerAuthModule> authModuleType = new AuthModuleType<ServerAuthModule>();
         authModuleType.setClassName(DummyServerAuthModule.class.getName());
         ClassLoaderLookup classLoaderLookup = new ConstantClassLoaderLookup(getClass().getClassLoader());
-        AuthConfigProvider authConfigProvider = JaspiUtil.wrapServerAuthModule("layer", "appContext1",
"id", authModuleType, true, classLoaderLookup, null);
+        AuthConfigProvider authConfigProvider = JaspiUtil.wrapServerAuthModule("layer", "appContext1",
"id", authModuleType, true, classLoaderLookup);
         String regId = factory.registerConfigProvider(authConfigProvider, "layer", "appContext1",
"description");
         DummyListener listener = new DummyListener();
         assertNotNull(factory.getConfigProvider("layer", "appContext1", listener));



Mime
View raw message