geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r677988 [2/2] - in /geronimo/components/jaspi/trunk/geronimo-jaspi/src: main/java/org/apache/geronimo/components/jaspi/ main/java/org/apache/geronimo/components/jaspi/model/ main/java/sxc/org/apache/geronimo/components/jaspi/model/ main/xsd...
Date Fri, 18 Jul 2008 18:19:56 GMT
Modified: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/ConfigProviderTypeJAXB.java
URL: http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/ConfigProviderTypeJAXB.java?rev=677988&r1=677987&r2=677988&view=diff
==============================================================================
--- geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/ConfigProviderTypeJAXB.java
(original)
+++ geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/ConfigProviderTypeJAXB.java
Fri Jul 18 11:19:55 2008
@@ -17,6 +17,7 @@
 import org.apache.geronimo.components.jaspi.model.ConfigProviderType;
 import org.apache.geronimo.components.jaspi.model.ServerAuthConfigType;
 import org.apache.geronimo.components.jaspi.model.StringMapAdapter;
+import org.apache.geronimo.components.jaspi.model.KeyedObjectMapAdapter;
 
 
 import static sxc.org.apache.geronimo.components.jaspi.model.ClientAuthConfigTypeJAXB.readClientAuthConfigType;
@@ -38,11 +39,13 @@
     private final static FieldAccessor<ConfigProviderType, String> configProviderTypeDescription
= new FieldAccessor<ConfigProviderType, String>(ConfigProviderType.class, "description");
     private final static FieldAccessor<ConfigProviderType, String> configProviderTypeClassName
= new FieldAccessor<ConfigProviderType, String>(ConfigProviderType.class, "className");
     private final static FieldAccessor<ConfigProviderType, Map<String, String>>
configProviderTypeProperties = new FieldAccessor<ConfigProviderType, Map<String, String>>(ConfigProviderType.class,
"properties");
-    private final static FieldAccessor<ConfigProviderType, List<ClientAuthConfigType>>
configProviderTypeClientAuthConfig = new FieldAccessor<ConfigProviderType, List<ClientAuthConfigType>>(ConfigProviderType.class,
"clientAuthConfig");
-    private final static FieldAccessor<ConfigProviderType, List<ServerAuthConfigType>>
configProviderTypeServerAuthConfig = new FieldAccessor<ConfigProviderType, List<ServerAuthConfigType>>(ConfigProviderType.class,
"serverAuthConfig");
+    private final static FieldAccessor<ConfigProviderType, Map<String, ClientAuthConfigType>>
configProviderTypeClientAuthConfig = new FieldAccessor<ConfigProviderType, Map<String,
ClientAuthConfigType>>(ConfigProviderType.class, "clientAuthConfig");
+    private final static FieldAccessor<ConfigProviderType, Map<String, ServerAuthConfigType>>
configProviderTypeServerAuthConfig = new FieldAccessor<ConfigProviderType, Map<String,
ServerAuthConfigType>>(ConfigProviderType.class, "serverAuthConfig");
     private final static FieldAccessor<ConfigProviderType, Boolean> configProviderTypePersistent
= new FieldAccessor<ConfigProviderType, Boolean>(ConfigProviderType.class, "persistent");
     private final static FieldAccessor<ConfigProviderType, String> configProviderTypeClassLoaderName
= new FieldAccessor<ConfigProviderType, String>(ConfigProviderType.class, "classLoaderName");
     private final static StringMapAdapter stringMapAdapterAdapter = new StringMapAdapter();
+    private final static KeyedObjectMapAdapter<ClientAuthConfigType> clientAuthConfigMapAdapter
= new KeyedObjectMapAdapter<ClientAuthConfigType>(ClientAuthConfigType.class);
+    private final static KeyedObjectMapAdapter<ServerAuthConfigType> serverAuthConfigMapAdapter
= new KeyedObjectMapAdapter<ServerAuthConfigType>(ServerAuthConfigType.class);
 
     public ConfigProviderTypeJAXB() {
         super(ConfigProviderType.class, null, new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi".intern(),
"configProviderType".intern()), ClientAuthConfigTypeJAXB.class, ServerAuthConfigTypeJAXB.class);
@@ -76,8 +79,8 @@
         ConfigProviderType configProviderType = new ConfigProviderType();
         context.beforeUnmarshal(configProviderType, lifecycleCallback);
 
-        List<ClientAuthConfigType> clientAuthConfig = null;
-        List<ServerAuthConfigType> serverAuthConfig = null;
+        List<ClientAuthConfigType> clientAuthConfigRaw = new ArrayList<ClientAuthConfigType>();
+        List<ServerAuthConfigType> serverAuthConfigRaw = new ArrayList<ServerAuthConfigType>();
 
         // Check xsi:type
         QName xsiType = reader.getXsiType();
@@ -128,27 +131,11 @@
             } else if (("clientAuthConfig" == elementReader.getLocalName())&&("http://geronimo.apache.org/xml/ns/geronimo-jaspi"
== elementReader.getNamespaceURI())) {
                 // ELEMENT: clientAuthConfig
                 ClientAuthConfigType clientAuthConfigItem = readClientAuthConfigType(elementReader,
context);
-                if (clientAuthConfig == null) {
-                    clientAuthConfig = configProviderTypeClientAuthConfig.getObject(reader,
context, configProviderType);
-                    if (clientAuthConfig!= null) {
-                        clientAuthConfig.clear();
-                    } else {
-                        clientAuthConfig = new ArrayList<ClientAuthConfigType>();
-                    }
-                }
-                clientAuthConfig.add(clientAuthConfigItem);
+                clientAuthConfigRaw.add(clientAuthConfigItem);
             } else if (("serverAuthConfig" == elementReader.getLocalName())&&("http://geronimo.apache.org/xml/ns/geronimo-jaspi"
== elementReader.getNamespaceURI())) {
                 // ELEMENT: serverAuthConfig
                 ServerAuthConfigType serverAuthConfigItem = readServerAuthConfigType(elementReader,
context);
-                if (serverAuthConfig == null) {
-                    serverAuthConfig = configProviderTypeServerAuthConfig.getObject(reader,
context, configProviderType);
-                    if (serverAuthConfig!= null) {
-                        serverAuthConfig.clear();
-                    } else {
-                        serverAuthConfig = new ArrayList<ServerAuthConfigType>();
-                    }
-                }
-                serverAuthConfig.add(serverAuthConfigItem);
+                serverAuthConfigRaw.add(serverAuthConfigItem);
             } else if (("persistent" == elementReader.getLocalName())&&("http://geronimo.apache.org/xml/ns/geronimo-jaspi"
== elementReader.getNamespaceURI())) {
                 // ELEMENT: persistent
                 Boolean persistent = ("1".equals(elementReader.getElementAsString())||"true".equals(elementReader.getElementAsString()));
@@ -161,10 +148,12 @@
                 context.unexpectedElement(elementReader, new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi",
"messageLayer"), new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "appContext"),
new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "description"), new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi",
"className"), new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "properties"),
new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "clientAuthConfig"), new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi",
"serverAuthConfig"), new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "persistent"),
new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "classLoaderName"));
             }
         }
-        if (clientAuthConfig!= null) {
+        if (clientAuthConfigRaw!= null) {
+            Map<String, ClientAuthConfigType> clientAuthConfig = clientAuthConfigMapAdapter.unmarshal(clientAuthConfigRaw.toArray(new
ClientAuthConfigType[clientAuthConfigRaw.size()]));
             configProviderTypeClientAuthConfig.setObject(reader, context, configProviderType,
clientAuthConfig);
         }
-        if (serverAuthConfig!= null) {
+        if (serverAuthConfigRaw!= null) {
+            Map<String, ServerAuthConfigType> serverAuthConfig = serverAuthConfigMapAdapter.unmarshal(serverAuthConfigRaw.toArray(new
ServerAuthConfigType[serverAuthConfigRaw.size()]));
             configProviderTypeServerAuthConfig.setObject(reader, context, configProviderType,
serverAuthConfig);
         }
 
@@ -243,7 +232,8 @@
         }
 
         // ELEMENT: clientAuthConfig
-        List<ClientAuthConfigType> clientAuthConfig = configProviderTypeClientAuthConfig.getObject(configProviderType,
context, configProviderType);
+        Map<String, ClientAuthConfigType> clientAuthConfigMap = configProviderTypeClientAuthConfig.getObject(configProviderType,
context, configProviderType);
+        ClientAuthConfigType[] clientAuthConfig = clientAuthConfigMapAdapter.marshal(clientAuthConfigMap);
         if (clientAuthConfig!= null) {
             for (ClientAuthConfigType clientAuthConfigItem: clientAuthConfig) {
                 writer.writeStartElement(prefix, "clientAuthConfig", "http://geronimo.apache.org/xml/ns/geronimo-jaspi");
@@ -257,7 +247,8 @@
         }
 
         // ELEMENT: serverAuthConfig
-        List<ServerAuthConfigType> serverAuthConfig = configProviderTypeServerAuthConfig.getObject(configProviderType,
context, configProviderType);
+        Map<String,ServerAuthConfigType> serverAuthConfigMap = configProviderTypeServerAuthConfig.getObject(configProviderType,
context, configProviderType);
+        ServerAuthConfigType[] serverAuthConfig = serverAuthConfigMapAdapter.marshal(serverAuthConfigMap);
         if (serverAuthConfig!= null) {
             for (ServerAuthConfigType serverAuthConfigItem: serverAuthConfig) {
                 writer.writeStartElement(prefix, "serverAuthConfig", "http://geronimo.apache.org/xml/ns/geronimo-jaspi");

Modified: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/JaspiTypeJAXB.java
URL: http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/JaspiTypeJAXB.java?rev=677988&r1=677987&r2=677988&view=diff
==============================================================================
--- geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/JaspiTypeJAXB.java
(original)
+++ geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/JaspiTypeJAXB.java
Fri Jul 18 11:19:55 2008
@@ -14,7 +14,7 @@
 import com.envoisolutions.sxc.util.Attribute;
 import com.envoisolutions.sxc.util.XoXMLStreamReader;
 import com.envoisolutions.sxc.util.XoXMLStreamWriter;
-import org.apache.geronimo.components.jaspi.model.ConfigProviderMapAdapter;
+import org.apache.geronimo.components.jaspi.model.KeyedObjectMapAdapter;
 import org.apache.geronimo.components.jaspi.model.ConfigProviderType;
 import org.apache.geronimo.components.jaspi.model.JaspiType;
 import static sxc.org.apache.geronimo.components.jaspi.model.ConfigProviderTypeJAXB.readConfigProviderType;
@@ -30,7 +30,7 @@
     public final static JaspiTypeJAXB INSTANCE = new JaspiTypeJAXB();
     private final static LifecycleCallback lifecycleCallback = new LifecycleCallback(JaspiType.class);
     private final static FieldAccessor<JaspiType, Map<String, ConfigProviderType>>
jaspiTypeConfigProvider = new FieldAccessor<JaspiType, Map<String, ConfigProviderType>>(JaspiType.class,
"configProvider");
-    private final static ConfigProviderMapAdapter configProviderMapAdapterAdapter = new ConfigProviderMapAdapter();
+    private final static KeyedObjectMapAdapter<ConfigProviderType> configProviderMapAdapterAdapter
= new KeyedObjectMapAdapter<ConfigProviderType>(ConfigProviderType.class);
 
     public JaspiTypeJAXB() {
         super(JaspiType.class, null, new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi".intern(),
"jaspiType".intern()));
@@ -102,7 +102,7 @@
             configProvider = configProviderMapAdapterAdapter.unmarshal(configProviderArray);
             jaspiTypeConfigProvider.setObject(reader, context, jaspiType, configProvider);
         } catch (Exception e) {
-//            context.xmlAdapterError(null, ConfigProviderMapAdapter.class, Map.class, Map.class,
e);
+//            context.xmlAdapterError(null, KeyedObjectMapAdapter.class, Map.class, Map.class,
e);
             throw e;
         }
 
@@ -138,7 +138,7 @@
         try {
             configProvider = configProviderMapAdapterAdapter.marshal(configProviderRaw);
         } catch (Exception e) {
-            context.xmlAdapterError(jaspiType, "configProvider", ConfigProviderMapAdapter.class,
Map.class, Map.class, e);
+            context.xmlAdapterError(jaspiType, "configProvider", KeyedObjectMapAdapter.class,
Map.class, Map.class, e);
         }
         if (configProvider!= null) {
             for (ConfigProviderType configProviderItem: configProvider) {

Modified: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/ServerAuthConfigTypeJAXB.java
URL: http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/ServerAuthConfigTypeJAXB.java?rev=677988&r1=677987&r2=677988&view=diff
==============================================================================
--- geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/ServerAuthConfigTypeJAXB.java
(original)
+++ geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/ServerAuthConfigTypeJAXB.java
Fri Jul 18 11:19:55 2008
@@ -3,6 +3,8 @@
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
+
 import javax.xml.XMLConstants;
 import javax.xml.namespace.QName;
 import com.envoisolutions.sxc.jaxb.FieldAccessor;
@@ -14,6 +16,7 @@
 import com.envoisolutions.sxc.util.XoXMLStreamWriter;
 import org.apache.geronimo.components.jaspi.model.ServerAuthConfigType;
 import org.apache.geronimo.components.jaspi.model.ServerAuthContextType;
+import org.apache.geronimo.components.jaspi.model.KeyedObjectMapAdapter;
 
 
 import static sxc.org.apache.geronimo.components.jaspi.model.ServerAuthContextTypeJAXB.readServerAuthContextType;
@@ -32,7 +35,8 @@
     private final static FieldAccessor<ServerAuthConfigType, String> serverAuthConfigTypeAppContext
= new FieldAccessor<ServerAuthConfigType, String>(ServerAuthConfigType.class, "appContext");
     private final static FieldAccessor<ServerAuthConfigType, String> serverAuthConfigTypeAuthenticationContextID
= new FieldAccessor<ServerAuthConfigType, String>(ServerAuthConfigType.class, "authenticationContextID");
     private final static FieldAccessor<ServerAuthConfigType, Boolean> serverAuthConfigType_protected
= new FieldAccessor<ServerAuthConfigType, Boolean>(ServerAuthConfigType.class, "_protected");
-    private final static FieldAccessor<ServerAuthConfigType, List<ServerAuthContextType>>
serverAuthConfigTypeServerAuthContext = new FieldAccessor<ServerAuthConfigType, List<ServerAuthContextType>>(ServerAuthConfigType.class,
"serverAuthContext");
+    private final static FieldAccessor<ServerAuthConfigType, Map<String, ServerAuthContextType>>
serverAuthConfigTypeServerAuthContext = new FieldAccessor<ServerAuthConfigType, Map<String,
ServerAuthContextType>>(ServerAuthConfigType.class, "serverAuthContext");
+    private final static KeyedObjectMapAdapter<ServerAuthContextType> serverAuthContextMapAdapter
= new KeyedObjectMapAdapter<ServerAuthContextType>(ServerAuthContextType.class);
 
     public ServerAuthConfigTypeJAXB() {
         super(ServerAuthConfigType.class, null, new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi".intern(),
"serverAuthConfigType".intern()), ServerAuthContextTypeJAXB.class);
@@ -66,7 +70,7 @@
         ServerAuthConfigType serverAuthConfigType = new ServerAuthConfigType();
         context.beforeUnmarshal(serverAuthConfigType, lifecycleCallback);
 
-        List<ServerAuthContextType> serverAuthContext = null;
+        List<ServerAuthContextType> serverAuthContextRaw = new ArrayList<ServerAuthContextType>();
 
         // Check xsi:type
         QName xsiType = reader.getXsiType();
@@ -104,20 +108,21 @@
             } else if (("serverAuthContext" == elementReader.getLocalName())&&("http://geronimo.apache.org/xml/ns/geronimo-jaspi"
== elementReader.getNamespaceURI())) {
                 // ELEMENT: serverAuthContext
                 ServerAuthContextType serverAuthContextItem = readServerAuthContextType(elementReader,
context);
-                if (serverAuthContext == null) {
-                    serverAuthContext = serverAuthConfigTypeServerAuthContext.getObject(reader,
context, serverAuthConfigType);
-                    if (serverAuthContext!= null) {
-                        serverAuthContext.clear();
-                    } else {
-                        serverAuthContext = new ArrayList<ServerAuthContextType>();
-                    }
-                }
-                serverAuthContext.add(serverAuthContextItem);
+//                if (serverAuthContextRaw == null) {
+//                    serverAuthContextRaw = serverAuthConfigTypeServerAuthContext.getObject(reader,
context, serverAuthConfigType);
+//                    if (serverAuthContextRaw != null) {
+//                        serverAuthContextRaw.clear();
+//                    } else {
+//                        serverAuthContextRaw = new ArrayList<ServerAuthContextType>();
+//                    }
+//                }
+                serverAuthContextRaw.add(serverAuthContextItem);
             } else {
                 context.unexpectedElement(elementReader, new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi",
"messageLayer"), new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "appContext"),
new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "authenticationContextID"),
new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "protected"), new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi",
"serverAuthContext"));
             }
         }
-        if (serverAuthContext!= null) {
+        if (serverAuthContextRaw != null) {
+            Map<String, ServerAuthContextType> serverAuthContext = serverAuthContextMapAdapter.unmarshal(serverAuthContextRaw.toArray(new
ServerAuthContextType[serverAuthContextRaw.size()]));
             serverAuthConfigTypeServerAuthContext.setObject(reader, context, serverAuthConfigType,
serverAuthContext);
         }
 
@@ -180,7 +185,8 @@
         writer.writeEndElement();
 
         // ELEMENT: serverAuthContext
-        List<ServerAuthContextType> serverAuthContext = serverAuthConfigTypeServerAuthContext.getObject(serverAuthConfigType,
context, serverAuthConfigType);
+        Map<String, ServerAuthContextType> serverAuthContextMap = serverAuthConfigTypeServerAuthContext.getObject(serverAuthConfigType,
context, serverAuthConfigType);
+        ServerAuthContextType[] serverAuthContext = serverAuthContextMapAdapter.marshal(serverAuthContextMap);
         if (serverAuthContext!= null) {
             for (ServerAuthContextType serverAuthContextItem: serverAuthContext) {
                 writer.writeStartElement(prefix, "serverAuthContext", "http://geronimo.apache.org/xml/ns/geronimo-jaspi");

Modified: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/xsd/geronimo-jaspi.xsd
URL: http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/xsd/geronimo-jaspi.xsd?rev=677988&r1=677987&r2=677988&view=diff
==============================================================================
--- geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/xsd/geronimo-jaspi.xsd (original)
+++ geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/xsd/geronimo-jaspi.xsd Fri Jul
18 11:19:55 2008
@@ -286,7 +286,7 @@
                     </xs:documentation>
                 </xs:annotation>
             </xs:element>
-            <xs:element name="authenticationContextID" type="xs:string">
+            <xs:element name="authenticationContextID" type="xs:string" minOccurs="0">
                 <xs:annotation>
                     <xs:documentation>
                         the constant value to be returned from getAuthContextID(MessageInfo
messageInfo)
@@ -313,10 +313,17 @@
                     </xs:documentation>
                 </xs:annotation>
             </xs:element>
-            <xs:element name="requestPolicy" type="jaspi:messagePolicyType">
+            <xs:element name="classLoaderName" type="xs:string" minOccurs="0">
+                <xs:annotation>
+                    <xs:documentation>
+                        name of classloader to load any needed classes (e.g. custom config
providers, modules, policy stuff)
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
+            <xs:element name="requestPolicy" type="jaspi:messagePolicyType" minOccurs="0">
 
             </xs:element>
-            <xs:element name="responsePolicy" type="jaspi:messagePolicyType">
+            <xs:element name="responsePolicy" type="jaspi:messagePolicyType" minOccurs="0">
 
             </xs:element>
             <xs:element name="options"

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=677988&r1=677987&r2=677988&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
Fri Jul 18 11:19:55 2008
@@ -23,6 +23,7 @@
 import javax.security.auth.message.config.AuthConfigFactory;
 import javax.security.auth.message.config.RegistrationListener;
 import javax.security.auth.message.config.AuthConfigFactory.RegistrationContext;
+import javax.security.auth.callback.CallbackHandler;
 
 import junit.framework.TestCase;
 
@@ -35,6 +36,8 @@
     protected void setUp() throws Exception {
         URL url = getClass().getClassLoader().getResource("test-jaspi.xml");
         AuthConfigFactoryImpl.staticConfigFile = new File(url.getPath());
+        CallbackHandler callbackHandler = null;
+        AuthConfigFactoryImpl.staticCallbackHandler = callbackHandler;
         AuthConfigFactory.setFactory(null);
     }
     

Modified: geronimo/components/jaspi/trunk/geronimo-jaspi/src/test/java/org/apache/geronimo/components/jaspi/model/JaxbTest.java
URL: http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk/geronimo-jaspi/src/test/java/org/apache/geronimo/components/jaspi/model/JaxbTest.java?rev=677988&r1=677987&r2=677988&view=diff
==============================================================================
--- geronimo/components/jaspi/trunk/geronimo-jaspi/src/test/java/org/apache/geronimo/components/jaspi/model/JaxbTest.java
(original)
+++ geronimo/components/jaspi/trunk/geronimo-jaspi/src/test/java/org/apache/geronimo/components/jaspi/model/JaxbTest.java
Fri Jul 18 11:19:55 2008
@@ -34,6 +34,11 @@
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLStreamException;
+import javax.security.auth.message.config.AuthConfigProvider;
+import javax.security.auth.message.config.ClientAuthConfig;
+import javax.security.auth.message.config.ClientAuthContext;
+import javax.security.auth.message.config.ServerAuthConfig;
+import javax.security.auth.message.config.ServerAuthContext;
 
 import org.testng.annotations.Test;
 import org.xml.sax.SAXException;
@@ -53,13 +58,40 @@
         JaspiType jaspi1 = loadJaspi(file);
         if (jaspi1.getConfigProvider().size() != count) throw new Exception("expected " +
count + " configprovider, not this: " + jaspi1.getConfigProvider());
         URL url = getClass().getClassLoader().getResource("test-jaspi.xml");
-        File newFile = new File(new File(url.getPath()).getParentFile(), "test-jaspi-2.xml");
+        File newFile = new File(new File(url.getPath()).getParentFile(), "test-jaspi-write.xml");
         Writer writer = new FileWriter(newFile);
         JaspiXmlUtil.writeJaspi(jaspi1, writer);
         JaspiType jaspi2 = JaspiXmlUtil.loadJaspi(new FileReader(newFile));
         if (jaspi2.getConfigProvider().size() != count) throw new Exception("expected " +
count + " configprovider, not this: " + jaspi2.getConfigProvider());
     }
 
+    @Test
+    public void testLoad2() throws Exception {
+        String file = "test-jaspi-2.xml";
+        JaspiType jaspi1 = loadJaspi(file);
+        if (jaspi1.getConfigProvider().size() != count) throw new Exception("expected " +
count + " configprovider, not this: " + jaspi1.getConfigProvider());
+        URL url = getClass().getClassLoader().getResource("test-jaspi.xml");
+        File newFile = new File(new File(url.getPath()).getParentFile(), "test-jaspi-2-write.xml");
+        Writer writer = new FileWriter(newFile);
+        JaspiXmlUtil.writeJaspi(jaspi1, writer);
+        JaspiType jaspi2 = JaspiXmlUtil.loadJaspi(new FileReader(newFile));
+        if (jaspi2.getConfigProvider().size() != count) throw new Exception("expected " +
count + " configprovider, not this: " + jaspi2.getConfigProvider());
+
+        AuthConfigProvider configProvider = jaspi1.getConfigProvider().get(ConfigProviderType.getRegistrationKey("Http",
"test-app1")).getProvider();
+        ClientAuthConfig clientAuthConfig = configProvider.getClientAuthConfig("Http", "test-app1",
null);
+        String authContextID = clientAuthConfig.getAuthContextID(null);
+        ClientAuthContext clientAuthContext = clientAuthConfig.getAuthContext(authContextID,
null, null);
+        clientAuthContext.secureRequest(null, null);
+
+        ServerAuthConfig serverAuthConfig = configProvider.getServerAuthConfig("Http", "test-app1",
null);
+         authContextID = serverAuthConfig.getAuthContextID(null);
+        ServerAuthContext serverAuthContext = serverAuthConfig.getAuthContext(authContextID,
null, null);
+        serverAuthContext.secureResponse(null, null);
+
+
+
+    }
+
     private JaspiType loadJaspi(String file) throws ParserConfigurationException, IOException,
SAXException, JAXBException, XMLStreamException {
         InputStream in = getClass().getClassLoader().getResourceAsStream(file);
         Reader reader = new InputStreamReader(in);

Added: geronimo/components/jaspi/trunk/geronimo-jaspi/src/test/java/org/apache/geronimo/components/jaspi/providers/DummyClientAuthModule.java
URL: http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk/geronimo-jaspi/src/test/java/org/apache/geronimo/components/jaspi/providers/DummyClientAuthModule.java?rev=677988&view=auto
==============================================================================
--- geronimo/components/jaspi/trunk/geronimo-jaspi/src/test/java/org/apache/geronimo/components/jaspi/providers/DummyClientAuthModule.java
(added)
+++ geronimo/components/jaspi/trunk/geronimo-jaspi/src/test/java/org/apache/geronimo/components/jaspi/providers/DummyClientAuthModule.java
Fri Jul 18 11:19:55 2008
@@ -0,0 +1,54 @@
+/*
+ * 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.providers;
+
+import java.util.Map;
+
+import javax.security.auth.message.module.ClientAuthModule;
+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.callback.CallbackHandler;
+import javax.security.auth.Subject;
+
+/**
+ * @version $Rev:$ $Date:$
+ */
+public class DummyClientAuthModule implements ClientAuthModule {
+    public Class[] getSupportedMessageTypes() {
+        return new Class[0];
+    }
+
+    public void initialize(MessagePolicy requestPolicy, MessagePolicy responsePolicy, CallbackHandler
handler, Map options) throws AuthException {
+    }
+
+    public void cleanSubject(MessageInfo messageInfo, Subject subject) throws AuthException
{
+    }
+
+    public AuthStatus secureRequest(MessageInfo messageInfo, Subject clientSubject) throws
AuthException {
+        return AuthStatus.SUCCESS;
+    }
+
+    public AuthStatus validateResponse(MessageInfo messageInfo, Subject clientSubject, Subject
serviceSubject) throws AuthException {
+        return AuthStatus.SUCCESS;
+    }
+}

Propchange: geronimo/components/jaspi/trunk/geronimo-jaspi/src/test/java/org/apache/geronimo/components/jaspi/providers/DummyClientAuthModule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/components/jaspi/trunk/geronimo-jaspi/src/test/java/org/apache/geronimo/components/jaspi/providers/DummyClientAuthModule.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/components/jaspi/trunk/geronimo-jaspi/src/test/java/org/apache/geronimo/components/jaspi/providers/DummyClientAuthModule.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/components/jaspi/trunk/geronimo-jaspi/src/test/java/org/apache/geronimo/components/jaspi/providers/DummyServerAuthModule.java
URL: http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk/geronimo-jaspi/src/test/java/org/apache/geronimo/components/jaspi/providers/DummyServerAuthModule.java?rev=677988&view=auto
==============================================================================
--- geronimo/components/jaspi/trunk/geronimo-jaspi/src/test/java/org/apache/geronimo/components/jaspi/providers/DummyServerAuthModule.java
(added)
+++ geronimo/components/jaspi/trunk/geronimo-jaspi/src/test/java/org/apache/geronimo/components/jaspi/providers/DummyServerAuthModule.java
Fri Jul 18 11:19:55 2008
@@ -0,0 +1,54 @@
+/*
+ * 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.providers;
+
+import java.util.Map;
+
+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.callback.CallbackHandler;
+import javax.security.auth.Subject;
+
+/**
+ * @version $Rev:$ $Date:$
+ */
+public class DummyServerAuthModule implements ServerAuthModule {
+    public Class[] getSupportedMessageTypes() {
+        return new Class[0];
+    }
+
+    public void initialize(MessagePolicy requestPolicy, MessagePolicy responsePolicy, CallbackHandler
handler, Map options) throws AuthException {
+    }
+
+    public void cleanSubject(MessageInfo messageInfo, Subject subject) throws AuthException
{
+    }
+
+    public AuthStatus secureResponse(MessageInfo messageInfo, Subject serviceSubject) throws
AuthException {
+        return AuthStatus.SEND_SUCCESS;
+    }
+
+    public AuthStatus validateRequest(MessageInfo messageInfo, Subject clientSubject, Subject
serviceSubject) throws AuthException {
+        return AuthStatus.SUCCESS;
+    }
+}

Propchange: geronimo/components/jaspi/trunk/geronimo-jaspi/src/test/java/org/apache/geronimo/components/jaspi/providers/DummyServerAuthModule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/components/jaspi/trunk/geronimo-jaspi/src/test/java/org/apache/geronimo/components/jaspi/providers/DummyServerAuthModule.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/components/jaspi/trunk/geronimo-jaspi/src/test/java/org/apache/geronimo/components/jaspi/providers/DummyServerAuthModule.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: geronimo/components/jaspi/trunk/geronimo-jaspi/src/test/resources/test-jaspi-2.xml
(from r677372, geronimo/components/jaspi/trunk/geronimo-jaspi/src/test/resources/test-jaspi.xml)
URL: http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk/geronimo-jaspi/src/test/resources/test-jaspi-2.xml?p2=geronimo/components/jaspi/trunk/geronimo-jaspi/src/test/resources/test-jaspi-2.xml&p1=geronimo/components/jaspi/trunk/geronimo-jaspi/src/test/resources/test-jaspi.xml&r1=677372&r2=677988&rev=677988&view=diff
==============================================================================
--- geronimo/components/jaspi/trunk/geronimo-jaspi/src/test/resources/test-jaspi.xml (original)
+++ geronimo/components/jaspi/trunk/geronimo-jaspi/src/test/resources/test-jaspi-2.xml Fri
Jul 18 11:19:55 2008
@@ -22,8 +22,24 @@
         <messageLayer>Http</messageLayer>
         <appContext>test-app1</appContext>
         <description>description</description>
-        <className>org.apache.geronimo.components.jaspi.providers.DummyProvider</className>
-        <properties>foo=bar</properties>
+        <clientAuthConfig>
+            <authenticationContextID>authenticationContextID1</authenticationContextID>
+            <protected>true</protected>
+            <clientAuthContext>
+                <clientAuthModule>
+                    <className>org.apache.geronimo.components.jaspi.providers.DummyClientAuthModule</className>
+                </clientAuthModule>
+            </clientAuthContext>
+        </clientAuthConfig>
+        <serverAuthConfig>
+            <authenticationContextID>authenticationContextID2</authenticationContextID>
+            <protected>true</protected>
+            <serverAuthContext>
+                <serverAuthModule>
+                    <className>org.apache.geronimo.components.jaspi.providers.DummyServerAuthModule</className>
+                </serverAuthModule>
+            </serverAuthContext>
+        </serverAuthConfig>
         <persistent>true</persistent>
     </configProvider>
 



Mime
View raw message