geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r939768 - in /geronimo/components/jaspi/trunk/geronimo-jaspi/src: main/java/org/apache/geronimo/components/jaspi/ main/java/org/apache/geronimo/components/jaspi/model/ test/java/org/apache/geronimo/components/jaspi/ test/java/org/apache/ger...
Date Fri, 30 Apr 2010 18:26:47 GMT
Author: djencks
Date: Fri Apr 30 18:26:46 2010
New Revision: 939768

URL: http://svn.apache.org/viewvc?rev=939768&view=rev
Log:
GERONIMO-5280 use ProviderLocator, not ClassLoaderLookup, for loading external classes

Added:
    geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/ConfigException.java   (with props)
    geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/JaspicUtil.java   (with props)
Removed:
    geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/ClassLoaderLookup.java
    geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/ConstantClassLoaderLookup.java
Modified:
    geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/AuthConfigFactoryImpl.java
    geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/AuthModuleType.java
    geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ClientAuthConfigType.java
    geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ClientAuthContextType.java
    geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ConfigProviderType.java
    geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/JaspiType.java
    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/KeyedObject.java
    geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/KeyedObjectMapAdapter.java
    geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/MessagePolicyType.java
    geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ProtectionPolicyType.java
    geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ServerAuthConfigType.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/main/java/org/apache/geronimo/components/jaspi/model/StringMapAdapter.java
    geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/TargetPolicyType.java
    geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/TargetType.java
    geronimo/components/jaspi/trunk/geronimo-jaspi/src/test/java/org/apache/geronimo/components/jaspi/AuthConfigFactoryImplTest.java
    geronimo/components/jaspi/trunk/geronimo-jaspi/src/test/java/org/apache/geronimo/components/jaspi/model/JaxbTest.java

Modified: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/AuthConfigFactoryImpl.java
URL: http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/AuthConfigFactoryImpl.java?rev=939768&r1=939767&r2=939768&view=diff
==============================================================================
--- geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/AuthConfigFactoryImpl.java (original)
+++ geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/AuthConfigFactoryImpl.java Fri Apr 30 18:26:46 2010
@@ -51,7 +51,6 @@ public class AuthConfigFactoryImpl exten
     private static ClassLoader contextClassLoader;
     private JaspiType jaspiType = new JaspiType();
 
-    private final ClassLoaderLookup classLoaderLookup;
     private final CallbackHandler callbackHandler;
     private final File configFile;
 
@@ -64,16 +63,15 @@ public class AuthConfigFactoryImpl exten
                 });
     }
 
-    public AuthConfigFactoryImpl(ClassLoaderLookup classLoaderLookup, CallbackHandler callbackHandler, File configFile) {
-        JaspiXmlUtil.initialize(classLoaderLookup, callbackHandler);
-        this.classLoaderLookup = classLoaderLookup;
+    public AuthConfigFactoryImpl(CallbackHandler callbackHandler, File configFile) {
+        JaspiXmlUtil.initialize(callbackHandler);
         this.callbackHandler = callbackHandler;
         this.configFile = configFile;
         loadConfig();
     }
 
     public AuthConfigFactoryImpl() {
-        this(new ConstantClassLoaderLookup(contextClassLoader), staticCallbackHandler, getConfigFile());
+        this(staticCallbackHandler, getConfigFile());
     }
 
     private static File getConfigFile() {
@@ -202,7 +200,7 @@ public class AuthConfigFactoryImpl exten
             }
             ctx.setClassName(className);
             ctx.setProperties(constructorParam);
-            ctx.initialize(classLoaderLookup, callbackHandler);
+            ctx.initialize(callbackHandler);
         } else {
             if (provider == null) {
                 throw new IllegalStateException("No config provider to set");

Added: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/ConfigException.java
URL: http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/ConfigException.java?rev=939768&view=auto
==============================================================================
--- geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/ConfigException.java (added)
+++ geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/ConfigException.java Fri Apr 30 18:26:46 2010
@@ -0,0 +1,43 @@
+/*
+ * 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;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConfigException extends Exception {
+
+    public ConfigException() {
+        super();
+    }
+
+    public ConfigException(String s) {
+        super(s);
+    }
+
+    public ConfigException(String s, Throwable throwable) {
+        super(s, throwable);
+    }
+
+    public ConfigException(Throwable throwable) {
+        super(throwable);
+    }
+}

Propchange: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/ConfigException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/ConfigException.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/ConfigException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/JaspicUtil.java
URL: http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/JaspicUtil.java?rev=939768&view=auto
==============================================================================
--- geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/JaspicUtil.java (added)
+++ geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/JaspicUtil.java Fri Apr 30 18:26:46 2010
@@ -0,0 +1,118 @@
+/*
+ * 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;
+
+import java.io.Reader;
+
+import javax.security.auth.message.AuthException;
+import javax.security.auth.message.config.AuthConfigFactory;
+import javax.security.auth.message.config.AuthConfigProvider;
+import javax.security.auth.message.module.ClientAuthModule;
+import javax.security.auth.message.module.ServerAuthModule;
+import org.apache.geronimo.components.jaspi.model.AuthModuleType;
+import org.apache.geronimo.components.jaspi.model.ClientAuthConfigType;
+import org.apache.geronimo.components.jaspi.model.ClientAuthContextType;
+import org.apache.geronimo.components.jaspi.model.ConfigProviderType;
+import org.apache.geronimo.components.jaspi.model.JaspiUtil;
+import org.apache.geronimo.components.jaspi.model.JaspiXmlUtil;
+import org.apache.geronimo.components.jaspi.model.ServerAuthConfigType;
+import org.apache.geronimo.components.jaspi.model.ServerAuthContextType;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JaspicUtil {
+
+    private JaspicUtil() {
+    }
+
+    public static String registerAuthConfigProvider(Reader config, String messageLayer, String appContext) throws ConfigException {
+        try {
+            ConfigProviderType configProviderType = JaspiXmlUtil.loadConfigProvider(config);
+            AuthConfigProvider authConfigProvider = JaspiUtil.wrapAuthConfigProvider(configProviderType);
+            return AuthConfigFactory.getFactory().registerConfigProvider(authConfigProvider, messageLayer, appContext, null);
+        } catch (Exception e) {
+            throw new ConfigException(e);
+        }
+    }
+
+    public static String registerClientAuthConfig(Reader config) throws ConfigException {
+        try {
+            ClientAuthConfigType clientAuthConfigType = JaspiXmlUtil.loadClientAuthConfig(config);
+            AuthConfigProvider authConfigProvider = JaspiUtil.wrapClientAuthConfig(clientAuthConfigType);
+            return AuthConfigFactory.getFactory().registerConfigProvider(authConfigProvider, clientAuthConfigType.getMessageLayer(), clientAuthConfigType.getAppContext(), null);
+        } catch (Exception e) {
+            throw new ConfigException(e);
+        }
+    }
+
+    public static String registerClientAuthContext(Reader config, boolean _protected) throws ConfigException {
+        try {
+            ClientAuthContextType clientAuthContextType = JaspiXmlUtil.loadClientAuthContext(config);
+            AuthConfigProvider authConfigProvider = JaspiUtil.wrapClientAuthContext(clientAuthContextType, _protected);
+            return AuthConfigFactory.getFactory().registerConfigProvider(authConfigProvider, clientAuthContextType.getMessageLayer(), clientAuthContextType.getAppContext(), null);
+        } catch (Exception e) {
+            throw new ConfigException(e);
+        }
+    }
+
+    public static String registerClientAuthModule(String messageLayer, String appContext, String authenticationContextID, Reader config, boolean _protected) throws ConfigException {
+        try {
+            AuthModuleType<ClientAuthModule> clientAuthModuleType = JaspiXmlUtil.loadClientAuthModule(config);
+            AuthConfigProvider authConfigProvider = JaspiUtil.wrapClientAuthModule(messageLayer, appContext, authenticationContextID, clientAuthModuleType, _protected);
+            return AuthConfigFactory.getFactory().registerConfigProvider(authConfigProvider, messageLayer, appContext, null);
+        } catch (Exception e) {
+            throw new ConfigException(e);
+        }
+    }
+
+
+    public static String registerServerAuthConfig(Reader config) throws ConfigException {
+        try {
+            ServerAuthConfigType serverAuthConfigType = JaspiXmlUtil.loadServerAuthConfig(config);
+            AuthConfigProvider authConfigProvider = JaspiUtil.wrapServerAuthConfig(serverAuthConfigType);
+            return AuthConfigFactory.getFactory().registerConfigProvider(authConfigProvider, serverAuthConfigType.getMessageLayer(), serverAuthConfigType.getAppContext(), null);
+        } catch (Exception e) {
+            throw new ConfigException(e);
+        }
+    }
+
+    public static String registerServerAuthContext(Reader config, boolean _protected) throws ConfigException {
+        try {
+            ServerAuthContextType serverAuthContextType = JaspiXmlUtil.loadServerAuthContext(config);
+            AuthConfigProvider authConfigProvider = JaspiUtil.wrapServerAuthContext(serverAuthContextType, _protected);
+            return AuthConfigFactory.getFactory().registerConfigProvider(authConfigProvider, serverAuthContextType.getMessageLayer(), serverAuthContextType.getAppContext(), null);
+        } catch (Exception e) {
+            throw new ConfigException(e);
+        }
+    }
+
+    public static String registerServerAuthModule(String messageLayer, String appContext, String authenticationContextID, Reader config, boolean _protected) throws ConfigException {
+        try {
+            AuthModuleType<ServerAuthModule> serverAuthModuleType = JaspiXmlUtil.loadServerAuthModule(config);
+            AuthConfigProvider authConfigProvider = JaspiUtil.wrapServerAuthModule(messageLayer, appContext, authenticationContextID, serverAuthModuleType, _protected);
+            return AuthConfigFactory.getFactory().registerConfigProvider(authConfigProvider, messageLayer, appContext, null);
+        } catch (Exception e) {
+            throw new ConfigException(e);
+        }
+    }
+
+}

Propchange: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/JaspicUtil.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/JaspicUtil.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/JaspicUtil.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/AuthModuleType.java
URL: http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/AuthModuleType.java?rev=939768&r1=939767&r2=939768&view=diff
==============================================================================
--- geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/AuthModuleType.java (original)
+++ geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/AuthModuleType.java Fri Apr 30 18:26:46 2010
@@ -24,7 +24,13 @@
 
 package org.apache.geronimo.components.jaspi.model;
 
-import org.apache.geronimo.components.jaspi.ClassLoaderLookup;
+import java.io.Serializable;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.util.Map;
 
 import javax.security.auth.callback.CallbackHandler;
 import javax.security.auth.message.AuthException;
@@ -34,13 +40,7 @@ import javax.xml.bind.annotation.XmlAcce
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import java.io.Serializable;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-import java.util.Map;
+import org.apache.geronimo.osgi.locator.ProviderLocator;
 
 
 /**
@@ -190,19 +190,18 @@ public class AuthModuleType<T>
         this.classLoaderName = classLoaderName;
     }
 
-    public T newAuthModule(final ClassLoaderLookup classLoaderLookup, final CallbackHandler callbackHandler) throws AuthException {
-        final ClassLoader classLoader = classLoaderLookup.getClassLoader(classLoaderName);
+    public T newAuthModule(final CallbackHandler callbackHandler) throws AuthException {
         T authModule;
         try {
             authModule = java.security.AccessController
             .doPrivileged(new PrivilegedExceptionAction<T>() {
                 public T run() throws ClassNotFoundException, SecurityException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException, AuthException {
-                    Class<? extends T> cl = (Class<? extends T>) Class.forName(className, true, classLoader);
+                    Class<? extends T> cl = (Class<? extends T>) ProviderLocator.loadClass(className, getClass(), Thread.currentThread().getContextClassLoader());
                     Constructor<? extends T> cnst = cl.getConstructor();
                     T authModule = cnst.newInstance();
                     Method m = cl.getMethod("initialize", MessagePolicy.class, MessagePolicy.class, CallbackHandler.class, Map.class);
-                    MessagePolicy reqPolicy = requestPolicy == null? null:requestPolicy.newMessagePolicy(classLoader);
-                    MessagePolicy respPolicy = responsePolicy == null? null: responsePolicy.newMessagePolicy(classLoader);
+                    MessagePolicy reqPolicy = requestPolicy == null? null:requestPolicy.newMessagePolicy();
+                    MessagePolicy respPolicy = responsePolicy == null? null: responsePolicy.newMessagePolicy();
                     m.invoke(authModule, reqPolicy, respPolicy, callbackHandler, options);
                     return authModule;
                 }

Modified: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ClientAuthConfigType.java
URL: http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ClientAuthConfigType.java?rev=939768&r1=939767&r2=939768&view=diff
==============================================================================
--- geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ClientAuthConfigType.java (original)
+++ geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ClientAuthConfigType.java Fri Apr 30 18:26:46 2010
@@ -24,7 +24,10 @@
 
 package org.apache.geronimo.components.jaspi.model;
 
-import org.apache.geronimo.components.jaspi.ClassLoaderLookup;
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
 
 import javax.security.auth.Subject;
 import javax.security.auth.callback.CallbackHandler;
@@ -37,10 +40,6 @@ import javax.xml.bind.annotation.XmlAcce
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import java.io.Serializable;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
 
 
 /**
@@ -243,18 +242,18 @@ public class ClientAuthConfigType
         return ConfigProviderType.getRegistrationKey(messageLayer, appContext);
     }
 
-    public void initialize(ClassLoaderLookup classLoaderLookup, CallbackHandler callbackHandler) throws AuthException {
+    public void initialize(CallbackHandler callbackHandler) throws AuthException {
     }
 
     public boolean isPersistent() {
         return true;
     }
 
-    public ClientAuthConfig newClientAuthConfig(String messageLayer, String appContext, ClassLoaderLookup classLoaderLookup, CallbackHandler callbackHandler) throws AuthException {
+    public ClientAuthConfig newClientAuthConfig(String messageLayer, String appContext, CallbackHandler callbackHandler) throws AuthException {
         Map<String, ClientAuthContext> authContextMap = new HashMap<String, ClientAuthContext>();
         for (ClientAuthContextType clientAuthContextType: getClientAuthContext().values()) {
             if (clientAuthContextType.match(messageLayer, appContext)) {
-                ClientAuthContext clientAuthContext = clientAuthContextType.newClientAuthContext(classLoaderLookup, callbackHandler);
+                ClientAuthContext clientAuthContext = clientAuthContextType.newClientAuthContext(callbackHandler);
                 String authContextID = clientAuthContextType.getAuthenticationContextID();
                 if (authContextID == null) {
                     authContextID = getAuthenticationContextID();

Modified: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ClientAuthContextType.java
URL: http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ClientAuthContextType.java?rev=939768&r1=939767&r2=939768&view=diff
==============================================================================
--- geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ClientAuthContextType.java (original)
+++ geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ClientAuthContextType.java Fri Apr 30 18:26:46 2010
@@ -24,7 +24,10 @@
 
 package org.apache.geronimo.components.jaspi.model;
 
-import org.apache.geronimo.components.jaspi.ClassLoaderLookup;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
 
 import javax.security.auth.Subject;
 import javax.security.auth.callback.CallbackHandler;
@@ -37,10 +40,6 @@ import javax.xml.bind.annotation.XmlAcce
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlType;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
 
 
 /**
@@ -191,17 +190,17 @@ public class ClientAuthContextType
         return ConfigProviderType.getRegistrationKey(messageLayer, appContext);
     }
 
-    public void initialize(ClassLoaderLookup classLoaderLookup, CallbackHandler callbackHandler) throws AuthException {
+    public void initialize(CallbackHandler callbackHandler) throws AuthException {
     }
 
     public boolean isPersistent() {
         return true;
     }
 
-    public ClientAuthContext newClientAuthContext(ClassLoaderLookup classLoaderLookup, CallbackHandler callbackHandler) throws AuthException {
+    public ClientAuthContext newClientAuthContext(CallbackHandler callbackHandler) throws AuthException {
         List<ClientAuthModule> clientAuthModules = new ArrayList<ClientAuthModule>();
         for (AuthModuleType<ClientAuthModule> clientAuthModuleType: clientAuthModule) {
-            ClientAuthModule instance = clientAuthModuleType.newAuthModule(classLoaderLookup, callbackHandler);
+            ClientAuthModule instance = clientAuthModuleType.newAuthModule(callbackHandler);
             clientAuthModules.add(instance);
         }
         return new ClientAuthContextImpl(clientAuthModules);

Modified: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ConfigProviderType.java
URL: http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ConfigProviderType.java?rev=939768&r1=939767&r2=939768&view=diff
==============================================================================
--- geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ConfigProviderType.java (original)
+++ geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ConfigProviderType.java Fri Apr 30 18:26:46 2010
@@ -24,13 +24,6 @@
 
 package org.apache.geronimo.components.jaspi.model;
 
-import org.apache.geronimo.components.jaspi.ClassLoaderLookup;
-
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.auth.message.AuthException;
-import javax.security.auth.message.config.*;
-import javax.xml.bind.annotation.*;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
 import java.io.Serializable;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
@@ -41,6 +34,21 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.message.AuthException;
+import javax.security.auth.message.config.AuthConfigFactory;
+import javax.security.auth.message.config.AuthConfigProvider;
+import javax.security.auth.message.config.ClientAuthConfig;
+import javax.security.auth.message.config.RegistrationListener;
+import javax.security.auth.message.config.ServerAuthConfig;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import org.apache.geronimo.osgi.locator.ProviderLocator;
+
 
 /**
  * <p>Java class for configProviderType complex type.
@@ -347,16 +355,15 @@ public class ConfigProviderType
         this.classLoaderName = classLoaderName;
     }
 
-    public void initialize(ClassLoaderLookup classLoaderLookup, CallbackHandler callbackHandler) {
+    public void initialize(CallbackHandler callbackHandler) {
         if (className == null) {
-            provider = new ConfigProviderImpl(getClientAuthConfig(), getServerAuthConfig(), classLoaderLookup);
+            provider = new ConfigProviderImpl(getClientAuthConfig(), getServerAuthConfig());
         } else {
-            final ClassLoader classLoader = classLoaderLookup.getClassLoader(classLoaderName);
             try {
                 provider = java.security.AccessController
                 .doPrivileged(new PrivilegedExceptionAction<AuthConfigProvider>() {
                     public AuthConfigProvider run() throws ClassNotFoundException, SecurityException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException {
-                        Class<? extends AuthConfigProvider> cl = Class.forName(className, true, classLoader).asSubclass(AuthConfigProvider.class);
+                        Class<? extends AuthConfigProvider> cl = ProviderLocator.loadClass(className, getClass(), Thread.currentThread().getContextClassLoader()).asSubclass(AuthConfigProvider.class);
                         Constructor<? extends AuthConfigProvider> cnst = cl.getConstructor(Map.class, AuthConfigFactory.class);
                         return cnst.newInstance(properties, authConfigFactory);
                     }
@@ -385,13 +392,10 @@ public class ConfigProviderType
 
     public static class ConfigProviderImpl implements AuthConfigProvider {
 
-//        private final ConfigProviderType configProviderType;
-        private final ClassLoaderLookup classLoaderLookup;
         private final Map<String, ClientAuthConfigType> clientConfigTypeMap;
         private final Map<String, ServerAuthConfigType> serverAuthConfigMap;
 
-        public ConfigProviderImpl(Map<String, ClientAuthConfigType> clientConfigTypeMap, Map<String, ServerAuthConfigType> serverAuthConfigMap, ClassLoaderLookup classLoaderLookup) {
-            this.classLoaderLookup = classLoaderLookup;
+        public ConfigProviderImpl(Map<String, ClientAuthConfigType> clientConfigTypeMap, Map<String, ServerAuthConfigType> serverAuthConfigMap) {
             this.clientConfigTypeMap = clientConfigTypeMap;
             this.serverAuthConfigMap = serverAuthConfigMap;
         }
@@ -424,7 +428,7 @@ public class ConfigProviderType
             }
             if (ctx != null) {
                 
-                return ctx.newClientAuthConfig(layer, appContext, classLoaderLookup, handler);
+                return ctx.newClientAuthConfig(layer, appContext, handler);
             }
             throw new AuthException("No suitable ClientAuthConfig");
         }
@@ -448,7 +452,7 @@ public class ConfigProviderType
             }
             if (ctx != null) {
 
-                return ctx.newServerAuthConfig(layer, appContext, classLoaderLookup, handler);
+                return ctx.newServerAuthConfig(layer, appContext, handler);
             }
             throw new AuthException("No suitable ServerAuthConfig");
         }

Modified: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/JaspiType.java
URL: http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/JaspiType.java?rev=939768&r1=939767&r2=939768&view=diff
==============================================================================
--- geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/JaspiType.java (original)
+++ geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/JaspiType.java Fri Apr 30 18:26:46 2010
@@ -24,13 +24,14 @@
 
 package org.apache.geronimo.components.jaspi.model;
 
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
 
 
 /**

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=939768&r1=939767&r2=939768&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 Fri Apr 30 18:26:46 2010
@@ -20,14 +20,13 @@
 
 package org.apache.geronimo.components.jaspi.model;
 
-import org.apache.geronimo.components.jaspi.ClassLoaderLookup;
+import java.util.Collections;
+import java.util.Map;
 
 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 java.util.Collections;
-import java.util.Map;
 
 /**
  * Convenience methods to wrap various jaspi objects into AuthConfigProvider instances, ready to be registered.
@@ -38,39 +37,39 @@ public class JaspiUtil {
     private JaspiUtil() {
     }
 
-    public static AuthConfigProvider wraptAuthConfigProvider(ConfigProviderType configProviderType, ClassLoaderLookup classLoaderLookup) {
-        return new ConfigProviderType.ConfigProviderImpl(configProviderType.getClientAuthConfig(), configProviderType.getServerAuthConfig(), classLoaderLookup);
+    public static AuthConfigProvider wrapAuthConfigProvider(ConfigProviderType configProviderType) {
+        return new ConfigProviderType.ConfigProviderImpl(configProviderType.getClientAuthConfig(), configProviderType.getServerAuthConfig());
     }
 
-    public static AuthConfigProvider wrapClientAuthConfig(ClientAuthConfigType clientAuthConfigType, ClassLoaderLookup classLoaderLookup) throws AuthException {
+    public static AuthConfigProvider wrapClientAuthConfig(ClientAuthConfigType clientAuthConfigType) throws AuthException {
         Map<String, ClientAuthConfigType> clientAuthConfig = Collections.singletonMap(clientAuthConfigType.getKey(), clientAuthConfigType);
-        return new ConfigProviderType.ConfigProviderImpl(clientAuthConfig, Collections.<String, ServerAuthConfigType>emptyMap(), classLoaderLookup);
+        return new ConfigProviderType.ConfigProviderImpl(clientAuthConfig, Collections.<String, ServerAuthConfigType>emptyMap());
     }
 
-    public static AuthConfigProvider wrapClientAuthContext(ClientAuthContextType clientAuthContextType, boolean _protected, ClassLoaderLookup classLoaderLookup) throws AuthException {
+    public static AuthConfigProvider wrapClientAuthContext(ClientAuthContextType clientAuthContextType, boolean _protected) throws AuthException {
         ClientAuthConfigType clientAuthConfigType = new ClientAuthConfigType(clientAuthContextType, _protected);
-        return wrapClientAuthConfig(clientAuthConfigType, classLoaderLookup);
+        return wrapClientAuthConfig(clientAuthConfigType);
     }
 
-    public static AuthConfigProvider wrapClientAuthModule(String messageLayer, String appContext, String authenticationContextID, AuthModuleType<ClientAuthModule> clientAuthModuleType, boolean _protected, ClassLoaderLookup classLoaderLookup) throws AuthException {
+    public static AuthConfigProvider wrapClientAuthModule(String messageLayer, String appContext, String authenticationContextID, AuthModuleType<ClientAuthModule> clientAuthModuleType, boolean _protected) throws AuthException {
         ClientAuthContextType clientAuthContextType = new ClientAuthContextType(messageLayer, appContext, authenticationContextID, clientAuthModuleType);
-        return wrapClientAuthContext(clientAuthContextType, _protected, classLoaderLookup);
+        return wrapClientAuthContext(clientAuthContextType, _protected);
     }
 
 
-    public static AuthConfigProvider wrapServerAuthConfig(ServerAuthConfigType serverAuthConfigType, ClassLoaderLookup classLoaderLookup) throws AuthException {
+    public static AuthConfigProvider wrapServerAuthConfig(ServerAuthConfigType serverAuthConfigType) throws AuthException {
         Map<String, ServerAuthConfigType> serverAuthConfig = Collections.singletonMap(serverAuthConfigType.getKey(), serverAuthConfigType);
-        return new ConfigProviderType.ConfigProviderImpl(Collections.<String, ClientAuthConfigType>emptyMap(), serverAuthConfig, classLoaderLookup);
+        return new ConfigProviderType.ConfigProviderImpl(Collections.<String, ClientAuthConfigType>emptyMap(), serverAuthConfig);
     }
 
-    public static AuthConfigProvider wrapServerAuthContext(ServerAuthContextType serverAuthContextType, boolean _protected, ClassLoaderLookup classLoaderLookup) throws AuthException {
+    public static AuthConfigProvider wrapServerAuthContext(ServerAuthContextType serverAuthContextType, boolean _protected) throws AuthException {
         ServerAuthConfigType serverAuthConfigType = new ServerAuthConfigType(serverAuthContextType, _protected);
-        return wrapServerAuthConfig(serverAuthConfigType, classLoaderLookup);
+        return wrapServerAuthConfig(serverAuthConfigType);
     }
 
-    public static AuthConfigProvider wrapServerAuthModule(String messageLayer, String appContext, String authenticationContextID, AuthModuleType<ServerAuthModule> serverAuthModuleType, boolean _protected, ClassLoaderLookup classLoaderLookup) throws AuthException {
+    public static AuthConfigProvider wrapServerAuthModule(String messageLayer, String appContext, String authenticationContextID, AuthModuleType<ServerAuthModule> serverAuthModuleType, boolean _protected) throws AuthException {
         ServerAuthContextType serverAuthContextType = new ServerAuthContextType(messageLayer, appContext, authenticationContextID, serverAuthModuleType);
-        return wrapServerAuthContext(serverAuthContextType, _protected, classLoaderLookup);
+        return wrapServerAuthContext(serverAuthContextType, _protected);
     }
 
 }

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=939768&r1=939767&r2=939768&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 Fri Apr 30 18:26:46 2010
@@ -20,21 +20,24 @@
 
 package org.apache.geronimo.components.jaspi.model;
 
-import org.apache.geronimo.components.jaspi.ClassLoaderLookup;
-import org.xml.sax.SAXException;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Writer;
+import java.util.Collections;
 
 import javax.security.auth.callback.CallbackHandler;
 import javax.security.auth.message.module.ClientAuthModule;
 import javax.security.auth.message.module.ServerAuthModule;
-import javax.xml.bind.*;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
-import java.io.IOException;
-import java.io.Reader;
-import java.io.Writer;
-import java.util.Collections;
+import org.xml.sax.SAXException;
 
 /**
  * @version $Rev$ $Date$
@@ -54,9 +57,7 @@ public class JaspiXmlUtil {
         }
     }
 
-    public static void initialize(ClassLoaderLookup classLoaderLookup, CallbackHandler callbackHandler) {
-//        configProviderMapAdapter = new KeyedObjectMapAdapter<ConfigProviderType>(classLoaderLookup, callbackHandler, ConfigProviderType.class);
-        KeyedObjectMapAdapter.staticClassLoaderLookup = classLoaderLookup;
+    public static void initialize(CallbackHandler callbackHandler) {
         KeyedObjectMapAdapter.staticCallbackHandler = callbackHandler;
     }
 

Modified: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/KeyedObject.java
URL: http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/KeyedObject.java?rev=939768&r1=939767&r2=939768&view=diff
==============================================================================
--- geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/KeyedObject.java (original)
+++ geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/KeyedObject.java Fri Apr 30 18:26:46 2010
@@ -20,8 +20,6 @@
 
 package org.apache.geronimo.components.jaspi.model;
 
-import org.apache.geronimo.components.jaspi.ClassLoaderLookup;
-
 import javax.security.auth.callback.CallbackHandler;
 import javax.security.auth.message.AuthException;
 
@@ -30,6 +28,6 @@ import javax.security.auth.message.AuthE
  */
 public interface KeyedObject {
     String getKey();
-    void initialize(ClassLoaderLookup classLoaderLookup, CallbackHandler callbackHandler) throws AuthException;
+    void initialize(CallbackHandler callbackHandler) throws AuthException;
     boolean isPersistent();
 }

Modified: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/KeyedObjectMapAdapter.java
URL: http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/KeyedObjectMapAdapter.java?rev=939768&r1=939767&r2=939768&view=diff
==============================================================================
--- geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/KeyedObjectMapAdapter.java (original)
+++ geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/KeyedObjectMapAdapter.java Fri Apr 30 18:26:46 2010
@@ -20,43 +20,30 @@
 
 package org.apache.geronimo.components.jaspi.model;
 
-import org.apache.geronimo.components.jaspi.ClassLoaderLookup;
-import org.apache.geronimo.components.jaspi.ConstantClassLoaderLookup;
-
-import javax.security.auth.callback.CallbackHandler;
-import javax.xml.bind.annotation.adapters.XmlAdapter;
 import java.lang.reflect.Array;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import javax.security.auth.callback.CallbackHandler;
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+
 /**
  * @version $Rev$ $Date$
  */
 public class KeyedObjectMapAdapter<T extends KeyedObject> extends XmlAdapter<T[], Map<String, T>> {
-    public static ClassLoaderLookup staticClassLoaderLookup;
     public static CallbackHandler staticCallbackHandler;
-    private final ClassLoaderLookup classLoaderLookup;
     private final CallbackHandler callbackHandler;
     private final Class<T> type;
 
-    public KeyedObjectMapAdapter(ClassLoaderLookup classLoaderLookup, CallbackHandler callbackHandler, Class<T> type) {
-        this.classLoaderLookup = classLoaderLookup;
+    public KeyedObjectMapAdapter(CallbackHandler callbackHandler, Class<T> type) {
         this.callbackHandler = callbackHandler;
         this.type = type;
     }
 
     public KeyedObjectMapAdapter(Class<T> type) {
-        if (staticClassLoaderLookup != null) {
-            this.classLoaderLookup = staticClassLoaderLookup;
-        } else {
-            ClassLoader testLoader = Thread.currentThread().getContextClassLoader();
-            final ClassLoader cl = testLoader == null ? KeyedObjectMapAdapter.class.getClassLoader() : testLoader;
-            classLoaderLookup = new ConstantClassLoaderLookup(cl);
-        }
-        this.type = type;
-        callbackHandler = staticCallbackHandler;
+        this(staticCallbackHandler, type);
     }
 
     public Map<String, T> unmarshal(T[] configProviderTypes) throws Exception {
@@ -66,7 +53,7 @@ public class KeyedObjectMapAdapter<T ext
                 if (configProviderType != null) {
                     String key = configProviderType.getKey();
                     map.put(key, configProviderType);
-                    configProviderType.initialize(classLoaderLookup, callbackHandler);
+                    configProviderType.initialize(callbackHandler);
                 }
             }
         }

Modified: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/MessagePolicyType.java
URL: http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/MessagePolicyType.java?rev=939768&r1=939767&r2=939768&view=diff
==============================================================================
--- geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/MessagePolicyType.java (original)
+++ geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/MessagePolicyType.java Fri Apr 30 18:26:46 2010
@@ -24,15 +24,16 @@
 
 package org.apache.geronimo.components.jaspi.model;
 
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
 import javax.security.auth.message.AuthException;
 import javax.security.auth.message.MessagePolicy;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlType;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
 
 
 /**
@@ -123,14 +124,14 @@ public class MessagePolicyType
         this.mandatory = value;
     }
 
-    public MessagePolicy newMessagePolicy(ClassLoader cl) throws AuthException {
+    public MessagePolicy newMessagePolicy() throws AuthException {
         if (targetPolicy == null || targetPolicy.size() == 0) {
             return null;
         }
         MessagePolicy.TargetPolicy[] targetPolicies = new MessagePolicy.TargetPolicy[targetPolicy.size()];
         int i = 0;
         for (TargetPolicyType targetPolicyType: targetPolicy) {
-            targetPolicies[i++] = targetPolicyType.newTargetPolicy(cl);
+            targetPolicies[i++] = targetPolicyType.newTargetPolicy();
         }
         return new MessagePolicy(targetPolicies, mandatory);
     }

Modified: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ProtectionPolicyType.java
URL: http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ProtectionPolicyType.java?rev=939768&r1=939767&r2=939768&view=diff
==============================================================================
--- geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ProtectionPolicyType.java (original)
+++ geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ProtectionPolicyType.java Fri Apr 30 18:26:46 2010
@@ -24,17 +24,19 @@
 
 package org.apache.geronimo.components.jaspi.model;
 
+import java.io.Serializable;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+
 import javax.security.auth.message.AuthException;
 import javax.security.auth.message.MessagePolicy;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlType;
-import java.io.Serializable;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
+import org.apache.geronimo.osgi.locator.ProviderLocator;
 
 
 /**
@@ -93,12 +95,12 @@ public class ProtectionPolicyType
         this.className = value;
     }
 
-    public MessagePolicy.ProtectionPolicy newProtectionPolicy(final ClassLoader classLoader) throws AuthException {
+    public MessagePolicy.ProtectionPolicy newProtectionPolicy() throws AuthException {
         try {
             return java.security.AccessController
             .doPrivileged(new PrivilegedExceptionAction<MessagePolicy.ProtectionPolicy>() {
                 public MessagePolicy.ProtectionPolicy run() throws ClassNotFoundException, SecurityException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException {
-                    Class<? extends MessagePolicy.ProtectionPolicy> cl = Class.forName(className, true, classLoader).asSubclass(MessagePolicy.ProtectionPolicy.class);
+                    Class<? extends MessagePolicy.ProtectionPolicy> cl = ProviderLocator.loadClass(className, getClass(), Thread.currentThread().getContextClassLoader()).asSubclass(MessagePolicy.ProtectionPolicy.class);
                     Constructor<? extends MessagePolicy.ProtectionPolicy> cnst = cl.getConstructor();
                     MessagePolicy.ProtectionPolicy target = cnst.newInstance();
                     return target;

Modified: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ServerAuthConfigType.java
URL: http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ServerAuthConfigType.java?rev=939768&r1=939767&r2=939768&view=diff
==============================================================================
--- geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ServerAuthConfigType.java (original)
+++ geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ServerAuthConfigType.java Fri Apr 30 18:26:46 2010
@@ -24,7 +24,10 @@
 
 package org.apache.geronimo.components.jaspi.model;
 
-import org.apache.geronimo.components.jaspi.ClassLoaderLookup;
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
 
 import javax.security.auth.Subject;
 import javax.security.auth.callback.CallbackHandler;
@@ -37,10 +40,6 @@ import javax.xml.bind.annotation.XmlAcce
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import java.io.Serializable;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
 
 
 /**
@@ -248,18 +247,18 @@ public class ServerAuthConfigType
         return ConfigProviderType.getRegistrationKey(messageLayer, appContext);
     }
 
-    public void initialize(ClassLoaderLookup classLoaderLookup, CallbackHandler callbackHandler) throws AuthException {
+    public void initialize(CallbackHandler callbackHandler) throws AuthException {
     }
 
     public boolean isPersistent() {
         return true;
     }
 
-    public ServerAuthConfig newServerAuthConfig(String messageLayer, String appContext, ClassLoaderLookup classLoaderLookup, CallbackHandler callbackHandler) throws AuthException {
+    public ServerAuthConfig newServerAuthConfig(String messageLayer, String appContext, CallbackHandler callbackHandler) throws AuthException {
         Map<String, ServerAuthContext> authContextMap = new HashMap<String, ServerAuthContext>();
         for (ServerAuthContextType serverAuthContextType: getServerAuthContext().values()) {
             if (serverAuthContextType.match(messageLayer, appContext)) {
-                ServerAuthContext serverAuthContext = serverAuthContextType.newServerAuthContext(classLoaderLookup, callbackHandler);
+                ServerAuthContext serverAuthContext = serverAuthContextType.newServerAuthContext(callbackHandler);
                 String authContextID = serverAuthContextType.getAuthenticationContextID();
                 if (authContextID == null) {
                     authContextID = getAuthenticationContextID();

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=939768&r1=939767&r2=939768&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 Fri Apr 30 18:26:46 2010
@@ -24,7 +24,10 @@
 
 package org.apache.geronimo.components.jaspi.model;
 
-import org.apache.geronimo.components.jaspi.ClassLoaderLookup;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
 
 import javax.security.auth.Subject;
 import javax.security.auth.callback.CallbackHandler;
@@ -37,10 +40,6 @@ import javax.xml.bind.annotation.XmlAcce
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlTransient;
 import javax.xml.bind.annotation.XmlType;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
 
 
 /**
@@ -192,10 +191,10 @@ public class ServerAuthContextType
         return ConfigProviderType.getRegistrationKey(messageLayer, appContext);
     }
 
-    public void initialize(ClassLoaderLookup classLoaderLookup, CallbackHandler callbackHandler) throws AuthException {
+    public void initialize(CallbackHandler callbackHandler) throws AuthException {
         List<ServerAuthModule> serverAuthModules = new ArrayList<ServerAuthModule>();
         for (AuthModuleType<ServerAuthModule> serverAuthModuleType: serverAuthModule) {
-            ServerAuthModule instance = serverAuthModuleType.newAuthModule(classLoaderLookup, callbackHandler);
+            ServerAuthModule instance = serverAuthModuleType.newAuthModule(callbackHandler);
             serverAuthModules.add(instance);
         }
         serverAuthContext = new ServerAuthContextImpl(serverAuthModules);
@@ -209,10 +208,10 @@ public class ServerAuthContextType
         return serverAuthContext;
     }
 
-    public ServerAuthContext newServerAuthContext(ClassLoaderLookup classLoaderLookup, CallbackHandler callbackHandler) throws AuthException {
+    public ServerAuthContext newServerAuthContext(CallbackHandler callbackHandler) throws AuthException {
         List<ServerAuthModule> serverAuthModules = new ArrayList<ServerAuthModule>();
         for (AuthModuleType<ServerAuthModule> serverAuthModuleType: serverAuthModule) {
-            ServerAuthModule instance = serverAuthModuleType.newAuthModule(classLoaderLookup, callbackHandler);
+            ServerAuthModule instance = serverAuthModuleType.newAuthModule(callbackHandler);
             serverAuthModules.add(instance);
         }
         return new ServerAuthContextImpl(serverAuthModules);

Modified: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/StringMapAdapter.java
URL: http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/StringMapAdapter.java?rev=939768&r1=939767&r2=939768&view=diff
==============================================================================
--- geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/StringMapAdapter.java (original)
+++ geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/StringMapAdapter.java Fri Apr 30 18:26:46 2010
@@ -20,13 +20,14 @@
 
 package org.apache.geronimo.components.jaspi.model;
 
-import javax.xml.bind.annotation.adapters.XmlAdapter;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Properties;
 
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+
 /**
  * jaxb helper class for maps
  *

Modified: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/TargetPolicyType.java
URL: http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/TargetPolicyType.java?rev=939768&r1=939767&r2=939768&view=diff
==============================================================================
--- geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/TargetPolicyType.java (original)
+++ geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/TargetPolicyType.java Fri Apr 30 18:26:46 2010
@@ -24,15 +24,16 @@
 
 package org.apache.geronimo.components.jaspi.model;
 
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
 import javax.security.auth.message.AuthException;
 import javax.security.auth.message.MessagePolicy;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlType;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
 
 
 /**
@@ -124,12 +125,12 @@ public class TargetPolicyType
         return this.target;
     }
 
-    public MessagePolicy.TargetPolicy newTargetPolicy(ClassLoader cl) throws AuthException {
+    public MessagePolicy.TargetPolicy newTargetPolicy() throws AuthException {
         MessagePolicy.Target[] targets = new MessagePolicy.Target[getTarget().size()];
         int i = 0;
         for (TargetType targetType: getTarget()) {
-            targets[i++] = targetType.newTarget(cl);
+            targets[i++] = targetType.newTarget();
         }
-        return new MessagePolicy.TargetPolicy(targets, protectionPolicy.newProtectionPolicy(cl));
+        return new MessagePolicy.TargetPolicy(targets, protectionPolicy.newProtectionPolicy());
     }
 }

Modified: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/TargetType.java
URL: http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/TargetType.java?rev=939768&r1=939767&r2=939768&view=diff
==============================================================================
--- geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/TargetType.java (original)
+++ geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/TargetType.java Fri Apr 30 18:26:46 2010
@@ -24,17 +24,19 @@
 
 package org.apache.geronimo.components.jaspi.model;
 
+import java.io.Serializable;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+
 import javax.security.auth.message.AuthException;
 import javax.security.auth.message.MessagePolicy;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlType;
-import java.io.Serializable;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
+import org.apache.geronimo.osgi.locator.ProviderLocator;
 
 
 /**
@@ -93,12 +95,12 @@ public class TargetType
         this.className = value;
     }
 
-    public MessagePolicy.Target newTarget(final ClassLoader classLoader) throws AuthException {
+    public MessagePolicy.Target newTarget() throws AuthException {
         try {
             return java.security.AccessController
             .doPrivileged(new PrivilegedExceptionAction<MessagePolicy.Target>() {
                 public MessagePolicy.Target run() throws ClassNotFoundException, SecurityException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException {
-                    Class<? extends MessagePolicy.Target> cl = Class.forName(className, true, classLoader).asSubclass(MessagePolicy.Target.class);
+                    Class<? extends MessagePolicy.Target> cl = ProviderLocator.loadClass(className, getClass(), Thread.currentThread().getContextClassLoader()).asSubclass(MessagePolicy.Target.class);
                     Constructor<? extends MessagePolicy.Target> cnst = cl.getConstructor();
                     MessagePolicy.Target target = cnst.newInstance();
                     return target;

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=939768&r1=939767&r2=939768&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 Apr 30 18:26:46 2010
@@ -16,11 +16,9 @@
  */
 package org.apache.geronimo.components.jaspi;
 
-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.config.AuthConfigFactory;
 import javax.security.auth.message.config.AuthConfigFactory.RegistrationContext;
 import javax.security.auth.message.config.AuthConfigProvider;
@@ -160,8 +158,7 @@ public class AuthConfigFactoryImplTest e
         AuthConfigFactory factory = AuthConfigFactory.getFactory();
         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);
+        AuthConfigProvider authConfigProvider = JaspiUtil.wrapClientAuthModule("layer", "appContext1", "id", authModuleType, true);
         String regId = factory.registerConfigProvider(authConfigProvider, "layer", "appContext1", "description");
         DummyListener listener = new DummyListener();
         assertNotNull(factory.getConfigProvider("layer", "appContext1", listener));
@@ -173,8 +170,7 @@ public class AuthConfigFactoryImplTest e
         AuthConfigFactory factory = AuthConfigFactory.getFactory();
         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);
+        AuthConfigProvider authConfigProvider = JaspiUtil.wrapServerAuthModule("layer", "appContext1", "id", authModuleType, true);
         String regId = factory.registerConfigProvider(authConfigProvider, "layer", "appContext1", "description");
         DummyListener listener = new DummyListener();
         assertNotNull(factory.getConfigProvider("layer", "appContext1", listener));

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=939768&r1=939767&r2=939768&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 Apr 30 18:26:46 2010
@@ -45,8 +45,6 @@ import javax.security.auth.callback.Call
 
 import org.testng.annotations.Test;
 import org.xml.sax.SAXException;
-import org.apache.geronimo.components.jaspi.ClassLoaderLookup;
-import org.apache.geronimo.components.jaspi.ConstantClassLoaderLookup;
 
 /**
  * @version $Rev$ $Date$
@@ -57,7 +55,6 @@ public class JaxbTest {
 
     private final int count = 2;
 
-    private final ClassLoaderLookup classLoaderLookup = new ConstantClassLoaderLookup(getClass().getClassLoader());
     private CallbackHandler callbackHandler;
 
     @Test
@@ -110,7 +107,7 @@ public class JaxbTest {
         String file = "config-provider";
         Reader reader = getReader(file);
         ConfigProviderType jaspi1 = JaspiXmlUtil.loadConfigProvider(reader);
-        jaspi1.initialize(classLoaderLookup, callbackHandler);
+        jaspi1.initialize(callbackHandler);
         File newFile = getWriteFile(file);
         Writer writer = new FileWriter(newFile);
         JaspiXmlUtil.writeConfigProvider(jaspi1, writer);
@@ -125,13 +122,13 @@ public class JaxbTest {
         String file = "client-auth-config";
         Reader reader = getReader(file);
         ClientAuthConfigType jaspi1 = JaspiXmlUtil.loadClientAuthConfig(reader);
-        jaspi1.initialize(classLoaderLookup, callbackHandler);
+        jaspi1.initialize(callbackHandler);
         File newFile = getWriteFile(file);
         Writer writer = new FileWriter(newFile);
         JaspiXmlUtil.writeClientAuthConfig(jaspi1, writer);
         ClientAuthConfigType jaspi2 = JaspiXmlUtil.loadClientAuthConfig(new FileReader(newFile));
 
-        ClientAuthConfig clientAuthConfig = jaspi1.newClientAuthConfig("Http", "app", classLoaderLookup, callbackHandler);
+        ClientAuthConfig clientAuthConfig = jaspi1.newClientAuthConfig("Http", "app", callbackHandler);
         checkClientAuthConfig(clientAuthConfig);
     }
 
@@ -145,7 +142,7 @@ public class JaxbTest {
         JaspiXmlUtil.writeClientAuthContext(jaspi1, writer);
         ClientAuthContextType jaspi2 = JaspiXmlUtil.loadClientAuthContext(new FileReader(newFile));
 
-        ClientAuthContext clientAuthConfig = jaspi1.newClientAuthContext(classLoaderLookup, callbackHandler);
+        ClientAuthContext clientAuthConfig = jaspi1.newClientAuthContext(callbackHandler);
         clientAuthConfig.secureRequest(null, null);
     }
 
@@ -159,7 +156,7 @@ public class JaxbTest {
         JaspiXmlUtil.writeClientAuthModule(jaspi1, writer);
         AuthModuleType jaspi2 = JaspiXmlUtil.loadClientAuthModule(new FileReader(newFile));
 
-        ClientAuthModule clientAuthConfig = jaspi1.newAuthModule(classLoaderLookup, callbackHandler);
+        ClientAuthModule clientAuthConfig = jaspi1.newAuthModule(callbackHandler);
         clientAuthConfig.secureRequest(null, null);
     }
 



Mime
View raw message