You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2010/04/30 22:44:32 UTC

svn commit: r939811 - /geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaspi/

Author: djencks
Date: Fri Apr 30 20:44:31 2010
New Revision: 939811

URL: http://svn.apache.org/viewvc?rev=939811&view=rev
Log:
GERONIMO-5280 use newer api in jaspi wrapper gbeans

Modified:
    geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaspi/AuthConfigFactoryGBean.java
    geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaspi/AuthConfigProviderGBean.java
    geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaspi/ClientAuthConfigGBean.java
    geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaspi/ClientAuthContextGBean.java
    geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaspi/ClientAuthModuleGBean.java
    geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaspi/ServerAuthConfigGBean.java
    geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaspi/ServerAuthContextGBean.java
    geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaspi/ServerAuthModuleGBean.java

Modified: geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaspi/AuthConfigFactoryGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaspi/AuthConfigFactoryGBean.java?rev=939811&r1=939810&r2=939811&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaspi/AuthConfigFactoryGBean.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaspi/AuthConfigFactoryGBean.java Fri Apr 30 20:44:31 2010
@@ -22,6 +22,7 @@ package org.apache.geronimo.security.jas
 
 import javax.security.auth.message.config.AuthConfigFactory;
 
+import org.apache.geronimo.gbean.annotation.GBean;
 import org.apache.geronimo.gbean.annotation.ParamAttribute;
 import org.apache.geronimo.gbean.annotation.ParamSpecial;
 import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
@@ -31,6 +32,7 @@ import org.apache.geronimo.gbean.annotat
  *
  * @version $Rev$ $Date$
  */
+@GBean
 public class AuthConfigFactoryGBean {
 
     public AuthConfigFactoryGBean(@ParamAttribute(name = "authConfigFactoryClassName") final String authConfigFactoryClassName,

Modified: geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaspi/AuthConfigProviderGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaspi/AuthConfigProviderGBean.java?rev=939811&r1=939810&r2=939811&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaspi/AuthConfigProviderGBean.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaspi/AuthConfigProviderGBean.java Fri Apr 30 20:44:31 2010
@@ -21,33 +21,16 @@
 package org.apache.geronimo.security.jaspi;
 
 import java.io.StringReader;
-import java.io.IOException;
 
+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.AuthConfig;
-import javax.security.auth.message.AuthException;
-import javax.security.auth.callback.CallbackHandler;
-import javax.xml.bind.JAXBException;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.stream.XMLStreamException;
 
+import org.apache.geronimo.components.jaspi.ConfigException;
+import org.apache.geronimo.components.jaspi.JaspicUtil;
+import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.gbean.annotation.GBean;
 import org.apache.geronimo.gbean.annotation.ParamAttribute;
-import org.apache.geronimo.gbean.annotation.ParamSpecial;
-import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
-import org.apache.geronimo.gbean.GBeanLifecycle;
-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.ClientAuthConfigType;
-import org.apache.geronimo.components.jaspi.model.ClientAuthContextType;
-import org.apache.geronimo.components.jaspi.model.AuthModuleType;
-import org.apache.geronimo.components.jaspi.model.ServerAuthConfigType;
-import org.apache.geronimo.components.jaspi.model.ServerAuthContextType;
-import org.apache.geronimo.components.jaspi.ClassLoaderLookup;
-import org.apache.geronimo.components.jaspi.ConstantClassLoaderLookup;
-import org.xml.sax.SAXException;
 
 /**
  * Holds a bit of xml configuring an AuthConfigProvider, [Client|Server][AuthConfig|AuthContext|AuthModule]
@@ -63,16 +46,10 @@ public class AuthConfigProviderGBean imp
 
     public AuthConfigProviderGBean(
             @ParamAttribute(name = "config") String config,
-            @ParamSpecial(type = SpecialAttributeType.classLoader) ClassLoader classLoader) throws AuthException, JAXBException, IOException, ParserConfigurationException, SAXException, XMLStreamException {
-        ClassLoaderLookup classLoaderLookup = new ConstantClassLoaderLookup(classLoader);
-
-        String messageLayer = null;
-        String appContext = null;
-
-        AuthConfigFactory authConfigFactory = AuthConfigFactory.getFactory();
-        ConfigProviderType configProviderType = JaspiXmlUtil.loadConfigProvider(new StringReader(config));
-        AuthConfigProvider authConfigProvider = JaspiUtil.wraptAuthConfigProvider(configProviderType, classLoaderLookup);
-        registrationID = authConfigFactory.registerConfigProvider(authConfigProvider, messageLayer, appContext, null);
+            @ParamAttribute(name = "messageLayer") String messageLayer,
+            @ParamAttribute(name = "appContext") String appContext
+    ) throws ConfigException {
+        registrationID = JaspicUtil.registerAuthConfigProvider(new StringReader(config), messageLayer, appContext);
     }
 
 

Modified: geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaspi/ClientAuthConfigGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaspi/ClientAuthConfigGBean.java?rev=939811&r1=939810&r2=939811&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaspi/ClientAuthConfigGBean.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaspi/ClientAuthConfigGBean.java Fri Apr 30 20:44:31 2010
@@ -21,34 +21,14 @@
 package org.apache.geronimo.security.jaspi;
 
 import java.io.StringReader;
-import java.io.IOException;
 
 import javax.security.auth.message.config.AuthConfigFactory;
-import javax.security.auth.message.config.AuthConfigProvider;
-import javax.security.auth.message.config.AuthConfig;
-import javax.security.auth.message.AuthException;
-import javax.security.auth.message.module.ServerAuthModule;
-import javax.security.auth.callback.CallbackHandler;
-import javax.xml.bind.JAXBException;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.stream.XMLStreamException;
 
+import org.apache.geronimo.components.jaspi.ConfigException;
+import org.apache.geronimo.components.jaspi.JaspicUtil;
+import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.gbean.annotation.GBean;
 import org.apache.geronimo.gbean.annotation.ParamAttribute;
-import org.apache.geronimo.gbean.annotation.ParamSpecial;
-import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
-import org.apache.geronimo.gbean.GBeanLifecycle;
-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.ClientAuthConfigType;
-import org.apache.geronimo.components.jaspi.model.ClientAuthContextType;
-import org.apache.geronimo.components.jaspi.model.AuthModuleType;
-import org.apache.geronimo.components.jaspi.model.ServerAuthConfigType;
-import org.apache.geronimo.components.jaspi.model.ServerAuthContextType;
-import org.apache.geronimo.components.jaspi.ClassLoaderLookup;
-import org.apache.geronimo.components.jaspi.ConstantClassLoaderLookup;
-import org.xml.sax.SAXException;
 
 /**
  * Holds a bit of xml configuring an AuthConfigProvider, [Client|Server][AuthConfig|AuthContext|AuthModule]
@@ -63,14 +43,9 @@ public class ClientAuthConfigGBean imple
     private final String registrationID;
 
     public ClientAuthConfigGBean(
-            @ParamAttribute(name = "config") String config,
-            @ParamSpecial(type = SpecialAttributeType.classLoader) ClassLoader classLoader) throws AuthException, JAXBException, IOException, ParserConfigurationException, SAXException, XMLStreamException {
-        ClassLoaderLookup classLoaderLookup = new ConstantClassLoaderLookup(classLoader);
-
-        AuthConfigFactory authConfigFactory = AuthConfigFactory.getFactory();
-        ClientAuthContextType clientAuthContextType = JaspiXmlUtil.loadClientAuthContext(new StringReader(config));
-        AuthConfigProvider authConfigProvider = JaspiUtil.wrapClientAuthContext(clientAuthContextType, true, classLoaderLookup);
-        registrationID = authConfigFactory.registerConfigProvider(authConfigProvider, clientAuthContextType.getMessageLayer(), clientAuthContextType.getAppContext(), null);
+            @ParamAttribute(name = "config") String config
+    ) throws ConfigException {
+        registrationID = JaspicUtil.registerClientAuthContext(new StringReader(config), true);
     }
 
 

Modified: geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaspi/ClientAuthContextGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaspi/ClientAuthContextGBean.java?rev=939811&r1=939810&r2=939811&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaspi/ClientAuthContextGBean.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaspi/ClientAuthContextGBean.java Fri Apr 30 20:44:31 2010
@@ -20,28 +20,15 @@
 
 package org.apache.geronimo.security.jaspi;
 
-import java.io.IOException;
 import java.io.StringReader;
 
-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.xml.bind.JAXBException;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.stream.XMLStreamException;
-
-import org.apache.geronimo.components.jaspi.ClassLoaderLookup;
-import org.apache.geronimo.components.jaspi.ConstantClassLoaderLookup;
-import org.apache.geronimo.components.jaspi.model.JaspiUtil;
-import org.apache.geronimo.components.jaspi.model.JaspiXmlUtil;
-import org.apache.geronimo.components.jaspi.model.ClientAuthContextType;
+
+import org.apache.geronimo.components.jaspi.ConfigException;
+import org.apache.geronimo.components.jaspi.JaspicUtil;
 import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.gbean.annotation.GBean;
 import org.apache.geronimo.gbean.annotation.ParamAttribute;
-import org.apache.geronimo.gbean.annotation.ParamSpecial;
-import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
-import org.xml.sax.SAXException;
 
 /**
  * Holds a bit of xml configuring an AuthConfigProvider, [Client|Server][AuthConfig|AuthContext|AuthModule]
@@ -56,14 +43,9 @@ public class ClientAuthContextGBean impl
     private final String registrationID;
 
     public ClientAuthContextGBean(
-            @ParamAttribute(name = "config") String config,
-            @ParamSpecial(type = SpecialAttributeType.classLoader) ClassLoader classLoader) throws AuthException, JAXBException, IOException, ParserConfigurationException, SAXException, XMLStreamException {
-        ClassLoaderLookup classLoaderLookup = new ConstantClassLoaderLookup(classLoader);
-
-        AuthConfigFactory authConfigFactory = AuthConfigFactory.getFactory();
-        ClientAuthContextType clientAuthContextType = JaspiXmlUtil.loadClientAuthContext(new StringReader(config));
-        AuthConfigProvider authConfigProvider = JaspiUtil.wrapClientAuthContext(clientAuthContextType, true, classLoaderLookup);
-        registrationID = authConfigFactory.registerConfigProvider(authConfigProvider, clientAuthContextType.getMessageLayer(), clientAuthContextType.getAppContext(), null);
+            @ParamAttribute(name = "config") String config
+    ) throws ConfigException {
+        registrationID = JaspicUtil.registerClientAuthContext(new StringReader(config), true);
     }
 
 

Modified: geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaspi/ClientAuthModuleGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaspi/ClientAuthModuleGBean.java?rev=939811&r1=939810&r2=939811&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaspi/ClientAuthModuleGBean.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaspi/ClientAuthModuleGBean.java Fri Apr 30 20:44:31 2010
@@ -20,29 +20,15 @@
 
 package org.apache.geronimo.security.jaspi;
 
-import java.io.IOException;
 import java.io.StringReader;
 
-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.module.ClientAuthModule;
-import javax.xml.bind.JAXBException;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.stream.XMLStreamException;
-
-import org.apache.geronimo.components.jaspi.ClassLoaderLookup;
-import org.apache.geronimo.components.jaspi.ConstantClassLoaderLookup;
-import org.apache.geronimo.components.jaspi.model.AuthModuleType;
-import org.apache.geronimo.components.jaspi.model.JaspiUtil;
-import org.apache.geronimo.components.jaspi.model.JaspiXmlUtil;
+
+import org.apache.geronimo.components.jaspi.ConfigException;
+import org.apache.geronimo.components.jaspi.JaspicUtil;
 import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.gbean.annotation.GBean;
 import org.apache.geronimo.gbean.annotation.ParamAttribute;
-import org.apache.geronimo.gbean.annotation.ParamSpecial;
-import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
-import org.xml.sax.SAXException;
 
 /**
  * Holds a bit of xml configuring an AuthConfigProvider, [Client|Client][AuthConfig|AuthContext|AuthModule]
@@ -60,14 +46,10 @@ public class ClientAuthModuleGBean imple
             @ParamAttribute(name = "messageLayer") String messageLayer,
             @ParamAttribute(name = "appContext") String appContext,
             @ParamAttribute(name = "authenticationID") String authenticationID,
-            @ParamAttribute(name = "config") String config,
-            @ParamSpecial(type = SpecialAttributeType.classLoader) ClassLoader classLoader) throws AuthException, JAXBException, IOException, ParserConfigurationException, SAXException, XMLStreamException {
-        ClassLoaderLookup classLoaderLookup = new ConstantClassLoaderLookup(classLoader);
+            @ParamAttribute(name = "config") String config
+    ) throws ConfigException {
 
-        AuthConfigFactory authConfigFactory = AuthConfigFactory.getFactory();
-        AuthModuleType<ClientAuthModule> clientAuthModuleType = JaspiXmlUtil.loadClientAuthModule(new StringReader(config));
-        AuthConfigProvider authConfigProvider = JaspiUtil.wrapClientAuthModule(messageLayer, appContext, authenticationID, clientAuthModuleType, true, classLoaderLookup);
-        registrationID = authConfigFactory.registerConfigProvider(authConfigProvider, messageLayer, appContext, null);
+        registrationID = JaspicUtil.registerClientAuthModule(messageLayer, appContext, authenticationID, new StringReader(config), true);
     }
 
 

Modified: geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaspi/ServerAuthConfigGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaspi/ServerAuthConfigGBean.java?rev=939811&r1=939810&r2=939811&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaspi/ServerAuthConfigGBean.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaspi/ServerAuthConfigGBean.java Fri Apr 30 20:44:31 2010
@@ -21,34 +21,14 @@
 package org.apache.geronimo.security.jaspi;
 
 import java.io.StringReader;
-import java.io.IOException;
 
 import javax.security.auth.message.config.AuthConfigFactory;
-import javax.security.auth.message.config.AuthConfigProvider;
-import javax.security.auth.message.config.AuthConfig;
-import javax.security.auth.message.AuthException;
-import javax.security.auth.message.module.ServerAuthModule;
-import javax.security.auth.callback.CallbackHandler;
-import javax.xml.bind.JAXBException;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.stream.XMLStreamException;
 
+import org.apache.geronimo.components.jaspi.ConfigException;
+import org.apache.geronimo.components.jaspi.JaspicUtil;
+import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.gbean.annotation.GBean;
 import org.apache.geronimo.gbean.annotation.ParamAttribute;
-import org.apache.geronimo.gbean.annotation.ParamSpecial;
-import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
-import org.apache.geronimo.gbean.GBeanLifecycle;
-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.ClientAuthConfigType;
-import org.apache.geronimo.components.jaspi.model.ClientAuthContextType;
-import org.apache.geronimo.components.jaspi.model.AuthModuleType;
-import org.apache.geronimo.components.jaspi.model.ServerAuthConfigType;
-import org.apache.geronimo.components.jaspi.model.ServerAuthContextType;
-import org.apache.geronimo.components.jaspi.ClassLoaderLookup;
-import org.apache.geronimo.components.jaspi.ConstantClassLoaderLookup;
-import org.xml.sax.SAXException;
 
 /**
  * Holds a bit of xml configuring an AuthConfigProvider, [Client|Server][AuthConfig|AuthContext|AuthModule]
@@ -63,14 +43,9 @@ public class ServerAuthConfigGBean imple
     private final String registrationID;
 
     public ServerAuthConfigGBean(
-            @ParamAttribute(name = "config") String config,
-            @ParamSpecial(type = SpecialAttributeType.classLoader) ClassLoader classLoader) throws AuthException, JAXBException, IOException, ParserConfigurationException, SAXException, XMLStreamException {
-        ClassLoaderLookup classLoaderLookup = new ConstantClassLoaderLookup(classLoader);
-
-        AuthConfigFactory authConfigFactory = AuthConfigFactory.getFactory();
-        ServerAuthContextType serverAuthContextType = JaspiXmlUtil.loadServerAuthContext(new StringReader(config));
-        AuthConfigProvider authConfigProvider = JaspiUtil.wrapServerAuthContext(serverAuthContextType, true, classLoaderLookup);
-        registrationID = authConfigFactory.registerConfigProvider(authConfigProvider, serverAuthContextType.getMessageLayer(), serverAuthContextType.getAppContext(), null);
+            @ParamAttribute(name = "config") String config
+    ) throws ConfigException {
+        registrationID = JaspicUtil.registerServerAuthContext(new StringReader(config), true);
     }
 
 

Modified: geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaspi/ServerAuthContextGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaspi/ServerAuthContextGBean.java?rev=939811&r1=939810&r2=939811&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaspi/ServerAuthContextGBean.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaspi/ServerAuthContextGBean.java Fri Apr 30 20:44:31 2010
@@ -20,28 +20,15 @@
 
 package org.apache.geronimo.security.jaspi;
 
-import java.io.IOException;
 import java.io.StringReader;
 
-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.xml.bind.JAXBException;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.stream.XMLStreamException;
-
-import org.apache.geronimo.components.jaspi.ClassLoaderLookup;
-import org.apache.geronimo.components.jaspi.ConstantClassLoaderLookup;
-import org.apache.geronimo.components.jaspi.model.JaspiUtil;
-import org.apache.geronimo.components.jaspi.model.JaspiXmlUtil;
-import org.apache.geronimo.components.jaspi.model.ServerAuthContextType;
+
+import org.apache.geronimo.components.jaspi.ConfigException;
+import org.apache.geronimo.components.jaspi.JaspicUtil;
 import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.gbean.annotation.GBean;
 import org.apache.geronimo.gbean.annotation.ParamAttribute;
-import org.apache.geronimo.gbean.annotation.ParamSpecial;
-import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
-import org.xml.sax.SAXException;
 
 /**
  * Holds a bit of xml configuring an AuthConfigProvider, [Client|Server][AuthConfig|AuthContext|AuthModule]
@@ -56,14 +43,9 @@ public class ServerAuthContextGBean impl
     private final String registrationID;
 
     public ServerAuthContextGBean(
-            @ParamAttribute(name = "config") String config,
-            @ParamSpecial(type = SpecialAttributeType.classLoader) ClassLoader classLoader) throws AuthException, JAXBException, IOException, ParserConfigurationException, SAXException, XMLStreamException {
-        ClassLoaderLookup classLoaderLookup = new ConstantClassLoaderLookup(classLoader);
-
-        AuthConfigFactory authConfigFactory = AuthConfigFactory.getFactory();
-        ServerAuthContextType serverAuthContextType = JaspiXmlUtil.loadServerAuthContext(new StringReader(config));
-        AuthConfigProvider authConfigProvider = JaspiUtil.wrapServerAuthContext(serverAuthContextType, true, classLoaderLookup);
-        registrationID = authConfigFactory.registerConfigProvider(authConfigProvider, serverAuthContextType.getMessageLayer(), serverAuthContextType.getAppContext(), null);
+            @ParamAttribute(name = "config") String config
+    ) throws ConfigException {
+        registrationID = JaspicUtil.registerServerAuthContext(new StringReader(config), true);
     }
 
 

Modified: geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaspi/ServerAuthModuleGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaspi/ServerAuthModuleGBean.java?rev=939811&r1=939810&r2=939811&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaspi/ServerAuthModuleGBean.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaspi/ServerAuthModuleGBean.java Fri Apr 30 20:44:31 2010
@@ -20,29 +20,15 @@
 
 package org.apache.geronimo.security.jaspi;
 
-import java.io.IOException;
 import java.io.StringReader;
 
-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.module.ServerAuthModule;
-import javax.xml.bind.JAXBException;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.stream.XMLStreamException;
-
-import org.apache.geronimo.components.jaspi.ClassLoaderLookup;
-import org.apache.geronimo.components.jaspi.ConstantClassLoaderLookup;
-import org.apache.geronimo.components.jaspi.model.AuthModuleType;
-import org.apache.geronimo.components.jaspi.model.JaspiUtil;
-import org.apache.geronimo.components.jaspi.model.JaspiXmlUtil;
+
+import org.apache.geronimo.components.jaspi.ConfigException;
+import org.apache.geronimo.components.jaspi.JaspicUtil;
 import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.gbean.annotation.GBean;
 import org.apache.geronimo.gbean.annotation.ParamAttribute;
-import org.apache.geronimo.gbean.annotation.ParamSpecial;
-import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
-import org.xml.sax.SAXException;
 
 /**
  * Holds a bit of xml configuring an AuthConfigProvider, [Client|Server][AuthConfig|AuthContext|AuthModule]
@@ -60,14 +46,9 @@ public class ServerAuthModuleGBean imple
             @ParamAttribute(name = "messageLayer") String messageLayer,
             @ParamAttribute(name = "appContext") String appContext,
             @ParamAttribute(name = "authenticationID") String authenticationID,
-            @ParamAttribute(name = "config") String config,
-            @ParamSpecial(type = SpecialAttributeType.classLoader) ClassLoader classLoader) throws AuthException, JAXBException, IOException, ParserConfigurationException, SAXException, XMLStreamException {
-        ClassLoaderLookup classLoaderLookup = new ConstantClassLoaderLookup(classLoader);
-
-        AuthConfigFactory authConfigFactory = AuthConfigFactory.getFactory();
-        AuthModuleType<ServerAuthModule> serverAuthModuleType = JaspiXmlUtil.loadServerAuthModule(new StringReader(config));
-        AuthConfigProvider authConfigProvider = JaspiUtil.wrapServerAuthModule(messageLayer, appContext, authenticationID, serverAuthModuleType, true, classLoaderLookup);
-        registrationID = authConfigFactory.registerConfigProvider(authConfigProvider, messageLayer, appContext, null);
+            @ParamAttribute(name = "config") String config
+    ) throws ConfigException {
+        registrationID = JaspicUtil.registerServerAuthModule(messageLayer, appContext, authenticationID, new StringReader(config), true);
     }