GERONIMO-5944 Remove use of sxc. Refactor into separate model and implementation
git-svn-id: https://svn.apache.org/repos/asf/geronimo/components/jaspi/trunk@1098801 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..686d81a
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,8 @@
+*.i??
+.project
+.classpath
+.settings
+target
+eclipse-classes
+bin
+*.log
diff --git a/geronimo-jaspi/pom.xml b/geronimo-jaspi/pom.xml
index 1f48c07..7e6aa08 100644
--- a/geronimo-jaspi/pom.xml
+++ b/geronimo-jaspi/pom.xml
@@ -16,7 +16,7 @@
limitations under the License.
-->
-<!-- $Rev$ $Date$ -->
+<!-- $Rev: 1032962 $ $Date: 2010-11-09 04:23:49 -0800 (Tue, 09 Nov 2010) $ -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
@@ -31,11 +31,11 @@
<groupId>org.apache.geronimo.components</groupId>
<artifactId>geronimo-jaspi</artifactId>
- <version>1.1.2-SNAPSHOT</version>
+ <version>2.0-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>Apache Geronimo JASPI implementation</name>
- <description>Geronimo JASPI implementation using jaxb/sxc for simple xml persistence.</description>
+ <description>Geronimo JASPI implementation using xml/jaxb for simple xml configuration.</description>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/geronimo/components/jaspi/trunk/geronimo-jaspi</connection>
@@ -89,12 +89,12 @@
<version>3.6</version>
</dependency>
- <dependency>
- <groupId>org.apache.geronimo.bundles</groupId>
- <artifactId>sxc-jaxb</artifactId>
- <!--<version>0.8-SNAPSHOT</version>-->
- <version>0.7.2_1</version>
- </dependency>
+ <!--<dependency>-->
+ <!--<groupId>org.apache.geronimo.bundles</groupId>-->
+ <!--<artifactId>sxc-jaxb</artifactId>-->
+ <!--<!–<version>0.8-SNAPSHOT</version>–>-->
+ <!--<version>0.7.2_1</version>-->
+ <!--</dependency>-->
<!--<dependency>-->
<!--<groupId>org.apache.geronimo.bundles</groupId>-->
@@ -108,12 +108,12 @@
<!--<version>2.2_1</version>-->
<!--</dependency>-->
- <dependency>
- <groupId>com.sun.xml.bind</groupId>
- <artifactId>jaxb-xjc</artifactId>
- <version>2.2</version>
- <scope>provided</scope>
- </dependency>
+ <!--<dependency>-->
+ <!--<groupId>com.sun.xml.bind</groupId>-->
+ <!--<artifactId>jaxb-xjc</artifactId>-->
+ <!--<version>2.2</version>-->
+ <!--<scope>provided</scope>-->
+ <!--</dependency>-->
<dependency>
<groupId>org.testng</groupId>
@@ -161,20 +161,22 @@
<version>2.3.4</version>
<configuration>
<instructions>
- <Export-Package>org.apache.geronimo.components.jaspi*;version=1.0</Export-Package>
+ <Export-Package>
+ org.apache.geronimo.components.jaspi;version=2.0,
+ org.apache.geronimo.components.jaspi.model;version=2.0
+ </Export-Package>
<Export-SPI-Provider>org.apache.geronimo.components.jaspi.AuthConfigFactoryImpl</Export-SPI-Provider>
<Import-Package>
- org.apache.geronimo.components.jaspi*;version="[1.0,1.1)",
- com.sun.xml.bind.*:resolution:=optional,
+ !org.apache.geronimo.components.jaspi.*,
+ org.apache.geronimo.osgi.registry.api;resolution:=optional,
*
</Import-Package>
- <!-- once a maven-bundle-plugin that can interpret the impl/uses version policy is released we can remove the explicit version ranges on import-package -->
<_versionpolicy-impl>[$(version;==;$(@)),$(version;=+;$(@)))</_versionpolicy-impl>
<_versionpolicy-uses>[$(version;==;$(@)),$(version;+;$(@)))</_versionpolicy-uses>
<Specification-Version>1.0</Specification-Version>
<Specification-Title>JASPIC</Specification-Title>
<Specification-Vendor>Sun Microsystems</Specification-Vendor>
- <Private-Package>org.apache.geronimo.osgi.locator;sxc*</Private-Package>
+ <Private-Package>org.apache.geronimo.osgi.locator</Private-Package>
<Bundle-Activator>org.apache.geronimo.osgi.locator.Activator</Bundle-Activator>
</instructions>
</configuration>
@@ -190,7 +192,7 @@
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
- <version>0.5</version>
+ <version>0.7.2</version>
<executions>
<execution>
<goals>
@@ -199,13 +201,22 @@
</execution>
</executions>
<configuration>
- <schemaDirectory>src/main/xsd</schemaDirectory>
- <packageName>org.apache.geronimo.components.jaspi.model</packageName>
+ <generatePackage>org.apache.geronimo.components.jaspi.model</generatePackage>
+ <specVersion>2.1</specVersion>
<extension>true</extension>
+ <episode>true</episode>
</configuration>
</plugin>
</plugins>
</build>
+ <!--<dependencies>-->
+ <!--<dependency>-->
+ <!--<groupId>com.sun.xml.bind</groupId>-->
+ <!--<artifactId>jaxb-xjc</artifactId>-->
+ <!--<version>2.2</version>-->
+ <!--<scope>provided</scope>-->
+ <!--</dependency>-->
+ <!--</dependencies>-->
</profile>
<profile>
<id>sxc-generate</id>
diff --git a/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/AuthConfigFactoryImpl.java b/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/AuthConfigFactoryImpl.java
index 5dd426d..5f98cd0 100644
--- a/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/AuthConfigFactoryImpl.java
+++ b/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/AuthConfigFactoryImpl.java
@@ -16,9 +16,11 @@
*/
package org.apache.geronimo.components.jaspi;
+import org.apache.geronimo.components.jaspi.impl.ConfigProviderImpl;
import org.apache.geronimo.components.jaspi.model.ConfigProviderType;
import org.apache.geronimo.components.jaspi.model.JaspiType;
import org.apache.geronimo.components.jaspi.model.JaspiXmlUtil;
+import org.apache.geronimo.components.jaspi.model.ObjectFactory;
import org.xml.sax.SAXException;
import javax.security.auth.AuthPermission;
@@ -30,14 +32,12 @@
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.stream.XMLStreamException;
import java.io.File;
-import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -53,7 +53,8 @@
public static CallbackHandler staticCallbackHandler;
private static ClassLoader contextClassLoader;
- private JaspiType jaspiType = new JaspiType();
+
+ private Map<String, ConfigProviderInfo> configProviders = Collections.emptyMap();
private final CallbackHandler callbackHandler;
private final File configFile;
@@ -94,14 +95,20 @@
return file;
}
+ public AuthConfigFactoryImpl(JaspiType jaspiType, CallbackHandler callbackHandler) {
+ this.callbackHandler = callbackHandler;
+ this.configFile = null;
+ initialize(jaspiType);
+ }
+
public synchronized String[] detachListener(RegistrationListener listener, String layer, String appContext) throws SecurityException {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(new AuthPermission("detachAuthListener"));
}
List<String> ids = new ArrayList<String>();
- for (Map.Entry<String, ConfigProviderType> entry : getRegistrations().entrySet()) {
- ConfigProviderType ctx = entry.getValue();
+ for (Map.Entry<String, ConfigProviderInfo> entry : getRegistrations().entrySet()) {
+ ConfigProviderInfo ctx = entry.getValue();
if ((layer == null || layer.equals(ctx.getMessageLayer())) &&
(appContext == null || appContext.equals(ctx.getAppContext()))) {
if (ctx.getListeners().remove(listener)) {
@@ -112,8 +119,8 @@
return ids.toArray(new String[ids.size()]);
}
- private Map<String, ConfigProviderType> getRegistrations() {
- return jaspiType.getConfigProvider();
+ private Map<String, ConfigProviderInfo> getRegistrations() {
+ return configProviders;
}
public synchronized AuthConfigProvider getConfigProvider(String layer, String appContext, RegistrationListener listener) {
@@ -123,7 +130,7 @@
if (appContext == null) {
throw new NullPointerException("appContext");
}
- ConfigProviderType ctx = getRegistrations().get(ConfigProviderType.getRegistrationKey(layer, appContext));
+ ConfigProviderInfo ctx = getRegistrations().get(ConfigProviderType.getRegistrationKey(layer, appContext));
if (ctx == null) {
ctx = getRegistrations().get(ConfigProviderType.getRegistrationKey(null, appContext));
}
@@ -137,7 +144,7 @@
if (listener != null) {
ctx.getListeners().add(listener);
}
- return ctx.getProvider();
+ return ctx.getAuthConfigProvider();
}
return null;
}
@@ -148,10 +155,10 @@
public synchronized String[] getRegistrationIDs(AuthConfigProvider provider) {
List<String> ids = new ArrayList<String>();
- for (Map.Entry<String, ConfigProviderType> entry : getRegistrations().entrySet()) {
- ConfigProviderType ctx = entry.getValue();
+ for (Map.Entry<String, ConfigProviderInfo> entry : getRegistrations().entrySet()) {
+ ConfigProviderInfo ctx = entry.getValue();
if (provider == null ||
- provider.getClass().getName().equals(ctx.getProvider().getClass().getName())) {
+ provider.getClass().getName().equals(ctx.getAuthConfigProvider().getClass().getName())) {
ids.add(entry.getKey());
}
}
@@ -187,16 +194,18 @@
private String registerConfigProvider(AuthConfigProvider provider, String layer, String appContext, String description, boolean persistent, Map<String, String> constructorParam, String className) {
String key = ConfigProviderType.getRegistrationKey(layer, appContext);
// Get or create context
- ConfigProviderType ctx = getRegistrations().get(key);
- if (ctx == null) {
- ctx = new ConfigProviderType(layer, appContext, persistent, persistent? null: this);
- getRegistrations().put(key, ctx);
+ ConfigProviderInfo info = getRegistrations().get(key);
+ List<RegistrationListener> listeners;
+ if (info == null) {
+ listeners = new ArrayList<RegistrationListener>();
} else {
- if (persistent != ctx.isPersistent()) {
+ if (persistent != info.isPersistent()) {
throw new IllegalArgumentException("Cannot change the persistence state");
}
+ listeners = info.getListeners();
}
// Create provider
+ ConfigProviderType ctx = new ConfigProviderType(layer, appContext, persistent, persistent? null: this);
ctx.setDescription(description);
if (persistent) {
if (provider != null) {
@@ -204,18 +213,18 @@
}
ctx.setClassName(className);
ctx.setProperties(constructorParam);
- ctx.initialize(callbackHandler);
+ provider = ConfigProviderImpl.newConfigProvider(this, ctx);
} else {
if (provider == null) {
throw new IllegalStateException("No config provider to set");
}
- ctx.setProvider(provider);
}
+ info = new ConfigProviderInfo(provider, ctx, listeners, persistent);
+ getRegistrations().put(key, info);
// Notify listeners
- List<RegistrationListener> listeners = ctx.getListeners();
for (RegistrationListener listener : listeners) {
- listener.notify(ctx.getMessageLayer(), ctx.getAppContext());
+ listener.notify(info.getMessageLayer(), info.getAppContext());
}
// Return registration Id
return key;
@@ -226,7 +235,7 @@
if (sm != null) {
sm.checkPermission(new AuthPermission("removeAuthRegistration"));
}
- ConfigProviderType ctx = getRegistrations().remove(registrationID);
+ ConfigProviderInfo ctx = getRegistrations().remove(registrationID);
saveConfig();
if (ctx != null) {
List<RegistrationListener> listeners = ctx.getListeners();
@@ -240,6 +249,7 @@
private void loadConfig() {
if (configFile != null && configFile.length() > 0) {
+ JaspiType jaspiType;
try {
FileReader in = new FileReader(configFile);
try {
@@ -258,14 +268,36 @@
} catch (XMLStreamException e) {
throw new SecurityException("Could not read config", e);
}
+ initialize(jaspiType);
}
}
+ private void initialize(JaspiType jaspiType) {
+ Map<String, ConfigProviderInfo> configProviderInfos = new HashMap<String, ConfigProviderInfo>();
+ try {
+ for (ConfigProviderType configProviderType: jaspiType.getConfigProvider()) {
+ AuthConfigProvider authConfigProvider = ConfigProviderImpl.newConfigProvider(this, configProviderType);
+ ConfigProviderInfo info = new ConfigProviderInfo(authConfigProvider, configProviderType, true);
+ configProviderInfos.put(configProviderType.getKey(), info);
+ }
+ } catch (Exception e) {
+ throw new SecurityException("Could not map config providers", e);
+ }
+ this.configProviders = configProviderInfos;
+ }
+
+
private void saveConfig() {
if (configFile != null) {
+ JaspiType jaspiType = new ObjectFactory().createJaspiType();
+
try {
- OutputStream outStream = new FileOutputStream(configFile);
- Writer out = new OutputStreamWriter(outStream, "UTF-8");
+ for (ConfigProviderInfo info: configProviders.values()) {
+ if (info.isPersistent()) {
+ jaspiType.getConfigProvider().add(info.getConfigProviderType());
+ }
+ }
+ FileWriter out = new FileWriter(configFile);
try {
JaspiXmlUtil.writeJaspi(jaspiType, out);
} finally {
@@ -277,9 +309,64 @@
throw new SecurityException("Could not write config", e);
} catch (JAXBException e) {
throw new SecurityException("Could not write config", e);
+ } catch (Exception e) {
+ throw new SecurityException("Could not write config", e);
}
}
}
+ private static class ConfigProviderInfo implements AuthConfigFactory.RegistrationContext {
+ private final AuthConfigProvider authConfigProvider;
+ private final ConfigProviderType configProviderType;
+ private final boolean persistent;
+ private final List<RegistrationListener> listeners;
+
+ private ConfigProviderInfo(AuthConfigProvider authConfigProvider, ConfigProviderType configProviderType, boolean persistent) {
+ this.authConfigProvider = authConfigProvider;
+ this.configProviderType = configProviderType;
+ this.persistent = persistent;
+ listeners = new ArrayList<RegistrationListener>();
+ }
+
+ private ConfigProviderInfo(AuthConfigProvider authConfigProvider, ConfigProviderType configProviderType, List<RegistrationListener> listeners, boolean persistent) {
+ this.authConfigProvider = authConfigProvider;
+ this.configProviderType = configProviderType;
+ this.listeners = listeners;
+ this.persistent = persistent;
+ }
+
+ public AuthConfigProvider getAuthConfigProvider() {
+ return authConfigProvider;
+ }
+
+ public ConfigProviderType getConfigProviderType() {
+ return configProviderType;
+ }
+
+ public List<RegistrationListener> getListeners() {
+ return listeners;
+ }
+
+ @Override
+ public String getAppContext() {
+ return configProviderType.getAppContext();
+ }
+
+ @Override
+ public String getDescription() {
+ return configProviderType.getDescription();
+ }
+
+ @Override
+ public String getMessageLayer() {
+ return configProviderType.getMessageLayer();
+ }
+
+ @Override
+ public boolean isPersistent() {
+ return persistent;
+ }
+ }
+
}
diff --git a/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/impl/ClientAuthConfigImpl.java b/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/impl/ClientAuthConfigImpl.java
new file mode 100644
index 0000000..75d623c
--- /dev/null
+++ b/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/impl/ClientAuthConfigImpl.java
@@ -0,0 +1,67 @@
+/*
+ * 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.impl;
+
+import java.util.Map;
+
+import javax.security.auth.Subject;
+import javax.security.auth.message.AuthException;
+import javax.security.auth.message.MessageInfo;
+import javax.security.auth.message.config.ClientAuthConfig;
+import javax.security.auth.message.config.ClientAuthContext;
+import org.apache.geronimo.components.jaspi.model.ClientAuthConfigType;
+
+/**
+* @version $Rev:$ $Date:$
+*/
+public class ClientAuthConfigImpl implements ClientAuthConfig {
+
+ private final ClientAuthConfigType clientAuthConfigType;
+ private final Map<String, ClientAuthContext> clientAuthContextMap;
+
+ public ClientAuthConfigImpl(ClientAuthConfigType clientAuthConfigType, Map<String, ClientAuthContext> clientAuthContextMap) {
+ this.clientAuthConfigType = clientAuthConfigType;
+ this.clientAuthContextMap = clientAuthContextMap;
+ }
+
+ public ClientAuthContext getAuthContext(String authContextID, Subject clientSubject, Map properties) throws AuthException {
+ return clientAuthContextMap.get(authContextID);
+ }
+
+ public String getAppContext() {
+ return clientAuthConfigType.getAppContext();
+ }
+
+ public String getAuthContextID(MessageInfo messageInfo) throws IllegalArgumentException {
+ return clientAuthConfigType.getAuthContextID(messageInfo);
+ }
+
+ public String getMessageLayer() {
+ return clientAuthConfigType.getMessageLayer();
+ }
+
+ public boolean isProtected() {
+ return clientAuthConfigType.isProtected();
+ }
+
+ public void refresh() throws SecurityException {
+ }
+}
diff --git a/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/impl/ClientAuthContextImpl.java b/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/impl/ClientAuthContextImpl.java
new file mode 100644
index 0000000..3ff9acc
--- /dev/null
+++ b/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/impl/ClientAuthContextImpl.java
@@ -0,0 +1,80 @@
+/*
+ * 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.impl;
+
+import java.util.List;
+
+import javax.security.auth.Subject;
+import javax.security.auth.message.AuthException;
+import javax.security.auth.message.AuthStatus;
+import javax.security.auth.message.MessageInfo;
+import javax.security.auth.message.config.ClientAuthContext;
+import javax.security.auth.message.module.ClientAuthModule;
+
+/**
+* @version $Rev:$ $Date:$
+*/
+public class ClientAuthContextImpl implements ClientAuthContext {
+
+ private final List<ClientAuthModule> clientAuthModules;
+
+ public ClientAuthContextImpl(List<ClientAuthModule> clientAuthModules) {
+ this.clientAuthModules = clientAuthModules;
+ }
+
+ public void cleanSubject(MessageInfo messageInfo, Subject subject) throws AuthException {
+ for (ClientAuthModule clientAuthModule : clientAuthModules) {
+ clientAuthModule.cleanSubject(messageInfo, subject);
+ }
+ }
+
+ public AuthStatus secureRequest(MessageInfo messageInfo, Subject clientSubject) throws AuthException {
+ for (ClientAuthModule clientAuthModule : clientAuthModules) {
+ AuthStatus result = clientAuthModule.secureRequest(messageInfo, clientSubject);
+
+ //jaspi spec p 74
+ if (result == AuthStatus.SUCCESS) {
+ continue;
+ }
+ if (result == AuthStatus.SEND_CONTINUE || result == AuthStatus.FAILURE) {
+ return result;
+ }
+ throw new AuthException("Invalid AuthStatus " + result + " from client auth module: " + clientAuthModule);
+ }
+ return AuthStatus.SUCCESS;
+ }
+
+ public AuthStatus validateResponse(MessageInfo messageInfo, Subject clientSubject, Subject serviceSubject) throws AuthException {
+ for (ClientAuthModule clientAuthModule : clientAuthModules) {
+ AuthStatus result = clientAuthModule.validateResponse(messageInfo, clientSubject, serviceSubject);
+
+ //jaspi spec p 74
+ if (result == AuthStatus.SUCCESS) {
+ continue;
+ }
+ if (result == AuthStatus.SEND_CONTINUE || result == AuthStatus.FAILURE) {
+ return result;
+ }
+ throw new AuthException("Invalid AuthStatus " + result + " from client auth module: " + clientAuthModule);
+ }
+ return AuthStatus.SUCCESS;
+ }
+}
diff --git a/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/impl/ConfigProviderImpl.java b/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/impl/ConfigProviderImpl.java
new file mode 100644
index 0000000..85134ff
--- /dev/null
+++ b/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/impl/ConfigProviderImpl.java
@@ -0,0 +1,347 @@
+/*
+ * 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.impl;
+
+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.ArrayList;
+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.MessagePolicy;
+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.ClientAuthContext;
+import javax.security.auth.message.config.ServerAuthConfig;
+import javax.security.auth.message.config.ServerAuthContext;
+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.KeyedObjectMapAdapter;
+import org.apache.geronimo.components.jaspi.model.MessagePolicyType;
+import org.apache.geronimo.components.jaspi.model.ProtectionPolicyType;
+import org.apache.geronimo.components.jaspi.model.ServerAuthConfigType;
+import org.apache.geronimo.components.jaspi.model.ServerAuthContextType;
+import org.apache.geronimo.components.jaspi.model.TargetPolicyType;
+import org.apache.geronimo.components.jaspi.model.TargetType;
+import org.apache.geronimo.osgi.locator.ProviderLocator;
+
+/**
+* @version $Rev:$ $Date:$
+*/
+public class ConfigProviderImpl implements AuthConfigProvider {
+
+ private final Map<String, ClientAuthConfigType> clientConfigTypeMap;
+ private final Map<String, ServerAuthConfigType> serverAuthConfigMap;
+
+ public ConfigProviderImpl(List<ClientAuthConfigType> clientAuthConfigTypes, List<ServerAuthConfigType> serverAuthConfigTypes) {
+ try {
+ this.clientConfigTypeMap = new KeyedObjectMapAdapter<ClientAuthConfigType>().unmarshal(clientAuthConfigTypes);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ try {
+ this.serverAuthConfigMap = new KeyedObjectMapAdapter<ServerAuthConfigType>().unmarshal(serverAuthConfigTypes);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * spec required constructor
+ * @param properties useless properties map
+ * @param factory useless factory
+ */
+ public ConfigProviderImpl(Map<String, String> properties, AuthConfigFactory factory) {
+ throw new RuntimeException("don't call this");
+ }
+
+ public ClientAuthConfig getClientAuthConfig(String layer, String appContext, CallbackHandler handler) throws AuthException, SecurityException {
+ if (layer == null) {
+ throw new NullPointerException("messageLayer");
+ }
+ if (appContext == null) {
+ throw new NullPointerException("appContext");
+ }
+ ClientAuthConfigType ctx = clientConfigTypeMap.get(ConfigProviderType.getRegistrationKey(layer, appContext));
+ if (ctx == null) {
+ ctx = clientConfigTypeMap.get(ConfigProviderType.getRegistrationKey(null, appContext));
+ }
+ if (ctx == null) {
+ ctx = clientConfigTypeMap.get(ConfigProviderType.getRegistrationKey(layer, null));
+ }
+ if (ctx == null) {
+ ctx = clientConfigTypeMap.get(ConfigProviderType.getRegistrationKey(null, null));
+ }
+ if (ctx != null) {
+
+ return newClientAuthConfig(ctx, layer, appContext, handler);
+ }
+ throw new AuthException("No suitable ClientAuthConfig");
+ }
+
+ public ServerAuthConfig getServerAuthConfig(String layer, String appContext, CallbackHandler handler) throws AuthException, SecurityException {
+ if (layer == null) {
+ throw new NullPointerException("messageLayer");
+ }
+ if (appContext == null) {
+ throw new NullPointerException("appContext");
+ }
+ ServerAuthConfigType ctx = serverAuthConfigMap.get(ConfigProviderType.getRegistrationKey(layer, appContext));
+ if (ctx == null) {
+ ctx = serverAuthConfigMap.get(ConfigProviderType.getRegistrationKey(null, appContext));
+ }
+ if (ctx == null) {
+ ctx = serverAuthConfigMap.get(ConfigProviderType.getRegistrationKey(layer, null));
+ }
+ if (ctx == null) {
+ ctx = serverAuthConfigMap.get(ConfigProviderType.getRegistrationKey(null, null));
+ }
+ if (ctx != null) {
+
+ return newServerAuthConfig(ctx, layer, appContext, handler);
+ }
+ throw new AuthException("No suitable ServerAuthConfig");
+ }
+
+ public void refresh() throws SecurityException {
+ }
+
+ public static AuthConfigProvider newConfigProvider(final AuthConfigFactory authConfigFactory, final ConfigProviderType configProviderType) {
+ AuthConfigProvider provider;
+ if (configProviderType.getClassName() == null) {
+ provider = new ConfigProviderImpl(configProviderType.getClientAuthConfig(), configProviderType.getServerAuthConfig());
+ } else {
+ try {
+ provider = java.security.AccessController
+ .doPrivileged(new PrivilegedExceptionAction<AuthConfigProvider>() {
+ public AuthConfigProvider run() throws ClassNotFoundException, SecurityException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException {
+ Class<? extends AuthConfigProvider> cl = ProviderLocator.loadClass(configProviderType.getClassName(), getClass(), Thread.currentThread().getContextClassLoader()).asSubclass(AuthConfigProvider.class);
+ Constructor<? extends AuthConfigProvider> cnst = cl.getConstructor(Map.class, AuthConfigFactory.class);
+ return cnst.newInstance(configProviderType.getProperties(), authConfigFactory);
+ }
+ });
+ } catch (PrivilegedActionException e) {
+ Exception inner = e.getException();
+ if (inner instanceof InstantiationException) {
+ throw new SecurityException("AuthConfigFactory error:"
+ + inner.getCause().getMessage(), inner.getCause());
+ } else {
+ throw new SecurityException("AuthConfigFactory error: " + inner, inner);
+ }
+ } catch (Exception e) {
+ throw new SecurityException("AuthConfigFactory error: " + e, e);
+ }
+ }
+ return provider;
+ }
+
+ static ClientAuthConfig newClientAuthConfig(ClientAuthConfigType clientAuthConfigType, String messageLayer, String appContext, CallbackHandler callbackHandler) throws AuthException {
+ Map<String, ClientAuthContext> authContextMap = new HashMap<String, ClientAuthContext>();
+ for (ClientAuthContextType clientAuthContextType: clientAuthConfigType.getClientAuthContext()) {
+ if (match(clientAuthContextType, messageLayer, appContext)) {
+ ClientAuthContext clientAuthContext = newClientAuthContext(clientAuthContextType, callbackHandler);
+ String authContextID = clientAuthContextType.getAuthenticationContextID();
+ if (authContextID == null) {
+ authContextID = clientAuthConfigType.getAuthenticationContextID();
+ }
+ if (!authContextMap.containsKey(authContextID)) {
+ authContextMap.put(authContextID, clientAuthContext);
+ }
+ }
+ }
+ return new ClientAuthConfigImpl(clientAuthConfigType, authContextMap);
+ }
+
+ static ClientAuthContext newClientAuthContext(ClientAuthContextType clientAuthContextType, CallbackHandler callbackHandler) throws AuthException {
+ List<ClientAuthModule> clientAuthModules = new ArrayList<ClientAuthModule>();
+ for (AuthModuleType<ClientAuthModule> clientAuthModuleType: clientAuthContextType.getClientAuthModule()) {
+ ClientAuthModule instance = newAuthModule(clientAuthModuleType, callbackHandler);
+ clientAuthModules.add(instance);
+ }
+ return new ClientAuthContextImpl(clientAuthModules);
+ }
+
+ private static boolean match(ClientAuthContextType clientAuthContextType, String messageLayer, String appContext) {
+ if (messageLayer == null) throw new NullPointerException("messageLayer");
+ if (appContext == null) throw new NullPointerException("appContext");
+ if (messageLayer.equals(clientAuthContextType.getMessageLayer())) {
+ return appContext.equals(clientAuthContextType.getAppContext()) || clientAuthContextType.getAppContext() == null;
+ }
+ if (clientAuthContextType.getMessageLayer() == null) {
+ return appContext.equals(clientAuthContextType.getAppContext()) || clientAuthContextType.getAppContext() == null;
+ }
+ return false;
+ }
+
+
+ static ServerAuthConfig newServerAuthConfig(ServerAuthConfigType serverAuthConfigType, String messageLayer, String appContext, CallbackHandler callbackHandler) throws AuthException {
+ Map<String, ServerAuthContext> authContextMap = new HashMap<String, ServerAuthContext>();
+ for (ServerAuthContextType serverAuthContextType: serverAuthConfigType.getServerAuthContext()) {
+ if (match(serverAuthContextType, messageLayer, appContext)) {
+ ServerAuthContext serverAuthContext = newServerAuthContext(serverAuthContextType, callbackHandler);
+ String authContextID = serverAuthContextType.getAuthenticationContextID();
+ if (authContextID == null) {
+ authContextID = serverAuthConfigType.getAuthenticationContextID();
+ }
+ if (!authContextMap.containsKey(authContextID)) {
+ authContextMap.put(authContextID, serverAuthContext);
+ }
+ }
+ }
+ return new ServerAuthConfigImpl(serverAuthConfigType, authContextMap);
+ }
+
+ static ServerAuthContext newServerAuthContext(ServerAuthContextType serverAuthContextType, CallbackHandler callbackHandler) throws AuthException {
+ List<ServerAuthModule> serverAuthModules = new ArrayList<ServerAuthModule>();
+ for (AuthModuleType<ServerAuthModule> serverAuthModuleType: serverAuthContextType.getServerAuthModule()) {
+ ServerAuthModule instance = newAuthModule(serverAuthModuleType, callbackHandler);
+ serverAuthModules.add(instance);
+ }
+ return new ServerAuthContextImpl(serverAuthModules);
+ }
+
+ private static boolean match(ServerAuthContextType serverAuthContextType, String messageLayer, String appContext) {
+ if (messageLayer == null) throw new NullPointerException("messageLayer");
+ if (appContext == null) throw new NullPointerException("appContext");
+ if (messageLayer.equals(serverAuthContextType.getMessageLayer())) {
+ return appContext.equals(serverAuthContextType.getAppContext()) || serverAuthContextType.getAppContext() == null;
+ }
+ if (serverAuthContextType.getMessageLayer() == null) {
+ return appContext.equals(serverAuthContextType.getAppContext()) || serverAuthContextType.getAppContext() == null;
+ }
+ return false;
+ }
+
+ static <T> T newAuthModule(final AuthModuleType authModuleType, 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>) ProviderLocator.loadClass(authModuleType.getClassName(), 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 = newMessagePolicy(authModuleType.getRequestPolicy());
+ MessagePolicy respPolicy = newMessagePolicy(authModuleType.getResponsePolicy());
+ m.invoke(authModule, reqPolicy, respPolicy, callbackHandler, authModuleType.getOptions());
+ return authModule;
+ }
+ });
+ } catch (PrivilegedActionException e) {
+ Exception inner = e.getException();
+ if (inner instanceof InstantiationException) {
+ throw (AuthException) new AuthException("AuthConfigFactory error:"
+ + inner.getCause().getMessage()).initCause(inner.getCause());
+ } else {
+ throw (AuthException) new AuthException("AuthConfigFactory error: " + inner).initCause(inner);
+ }
+ } catch (Exception e) {
+ throw (AuthException) new AuthException("AuthConfigFactory error: " + e).initCause(e);
+ }
+ return authModule;
+ }
+
+ private static MessagePolicy newMessagePolicy(MessagePolicyType messagePolicyType) throws AuthException {
+ if (messagePolicyType == null) {
+ return null;
+ }
+ if (messagePolicyType.getTargetPolicy().size() == 0) {
+ return null;
+ }
+ MessagePolicy.TargetPolicy[] targetPolicies = new MessagePolicy.TargetPolicy[messagePolicyType.getTargetPolicy().size()];
+ int i = 0;
+ for (TargetPolicyType targetPolicyType: messagePolicyType.getTargetPolicy()) {
+ targetPolicies[i++] = newTargetPolicy(targetPolicyType);
+ }
+ return new MessagePolicy(targetPolicies, messagePolicyType.isMandatory());
+ }
+
+ private static MessagePolicy.TargetPolicy newTargetPolicy(TargetPolicyType targetPolicyType) throws AuthException {
+ MessagePolicy.Target[] targets = new MessagePolicy.Target[targetPolicyType.getTarget().size()];
+ int i = 0;
+ for (TargetType targetType: targetPolicyType.getTarget()) {
+ targets[i++] = newTarget(targetType);
+ }
+ return new MessagePolicy.TargetPolicy(targets, newProtectionPolicy(targetPolicyType.getProtectionPolicy()));
+ }
+
+ private static MessagePolicy.Target newTarget(final TargetType targetType) 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 = ProviderLocator.loadClass(targetType.getClassName(), getClass(), Thread.currentThread().getContextClassLoader()).asSubclass(MessagePolicy.Target.class);
+ Constructor<? extends MessagePolicy.Target> cnst = cl.getConstructor();
+ MessagePolicy.Target target = cnst.newInstance();
+ return target;
+ }
+ });
+ } catch (PrivilegedActionException e) {
+ Exception inner = e.getException();
+ if (inner instanceof InstantiationException) {
+ throw (AuthException) new AuthException("AuthConfigFactory error:"
+ + inner.getCause().getMessage()).initCause(inner.getCause());
+ } else {
+ throw (AuthException) new AuthException("AuthConfigFactory error: " + inner).initCause(inner);
+ }
+ } catch (Exception e) {
+ throw (AuthException) new AuthException("AuthConfigFactory error: " + e).initCause(e);
+ }
+
+ }
+
+ private static MessagePolicy.ProtectionPolicy newProtectionPolicy(final ProtectionPolicyType protectionPolicyType) 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 = ProviderLocator.loadClass(protectionPolicyType.getClassName(), getClass(), Thread.currentThread().getContextClassLoader()).asSubclass(MessagePolicy.ProtectionPolicy.class);
+ Constructor<? extends MessagePolicy.ProtectionPolicy> cnst = cl.getConstructor();
+ MessagePolicy.ProtectionPolicy target = cnst.newInstance();
+ return target;
+ }
+ });
+ } catch (PrivilegedActionException e) {
+ Exception inner = e.getException();
+ if (inner instanceof InstantiationException) {
+ throw (AuthException) new AuthException("AuthConfigFactory error:"
+ + inner.getCause().getMessage()).initCause(inner.getCause());
+ } else {
+ throw (AuthException) new AuthException("AuthConfigFactory error: " + inner).initCause(inner);
+ }
+ } catch (Exception e) {
+ throw (AuthException) new AuthException("AuthConfigFactory error: " + e).initCause(e);
+ }
+ }
+
+}
diff --git a/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/impl/ServerAuthConfigImpl.java b/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/impl/ServerAuthConfigImpl.java
new file mode 100644
index 0000000..eca3a08
--- /dev/null
+++ b/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/impl/ServerAuthConfigImpl.java
@@ -0,0 +1,67 @@
+/*
+ * 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.impl;
+
+import java.util.Map;
+
+import javax.security.auth.Subject;
+import javax.security.auth.message.AuthException;
+import javax.security.auth.message.MessageInfo;
+import javax.security.auth.message.config.ServerAuthConfig;
+import javax.security.auth.message.config.ServerAuthContext;
+import org.apache.geronimo.components.jaspi.model.ServerAuthConfigType;
+
+/**
+* @version $Rev:$ $Date:$
+*/
+public class ServerAuthConfigImpl implements ServerAuthConfig {
+
+ private final ServerAuthConfigType serverAuthConfigType;
+ private final Map<String, ServerAuthContext> serverAuthContextMap;
+
+ public ServerAuthConfigImpl(ServerAuthConfigType serverAuthConfigType, Map<String, ServerAuthContext> serverAuthContextMap) {
+ this.serverAuthConfigType = serverAuthConfigType;
+ this.serverAuthContextMap = serverAuthContextMap;
+ }
+
+ public ServerAuthContext getAuthContext(String authContextID, Subject serverSubject, Map properties) throws AuthException {
+ return serverAuthContextMap.get(authContextID);
+ }
+
+ public String getAppContext() {
+ return serverAuthConfigType.getAppContext();
+ }
+
+ public String getAuthContextID(MessageInfo messageInfo) throws IllegalArgumentException {
+ return serverAuthConfigType.getAuthContextID(messageInfo);
+ }
+
+ public String getMessageLayer() {
+ return serverAuthConfigType.getMessageLayer();
+ }
+
+ public boolean isProtected() {
+ return serverAuthConfigType.isProtected();
+ }
+
+ public void refresh() throws SecurityException {
+ }
+}
diff --git a/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/impl/ServerAuthContextImpl.java b/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/impl/ServerAuthContextImpl.java
new file mode 100644
index 0000000..0972cb8
--- /dev/null
+++ b/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/impl/ServerAuthContextImpl.java
@@ -0,0 +1,81 @@
+/*
+ * 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.impl;
+
+import java.util.List;
+
+import javax.security.auth.Subject;
+import javax.security.auth.message.AuthException;
+import javax.security.auth.message.AuthStatus;
+import javax.security.auth.message.MessageInfo;
+import javax.security.auth.message.config.ServerAuthContext;
+import javax.security.auth.message.module.ServerAuthModule;
+
+/**
+* @version $Rev:$ $Date:$
+*/
+public class ServerAuthContextImpl implements ServerAuthContext {
+
+ private final List<ServerAuthModule> serverAuthModules;
+
+ public ServerAuthContextImpl(List<ServerAuthModule> serverAuthModules) {
+ this.serverAuthModules = serverAuthModules;
+ }
+
+ public void cleanSubject(MessageInfo messageInfo, Subject subject) throws AuthException {
+ for (ServerAuthModule serverAuthModule : serverAuthModules) {
+ serverAuthModule.cleanSubject(messageInfo, subject);
+ }
+ }
+
+ public AuthStatus secureResponse(MessageInfo messageInfo, Subject serviceSubject) throws AuthException {
+ for (ServerAuthModule serverAuthModule : serverAuthModules) {
+ AuthStatus result = serverAuthModule.secureResponse(messageInfo, serviceSubject);
+
+ //jaspi spec p 86
+ if (result == AuthStatus.SEND_SUCCESS) {
+ continue;
+ }
+ if (result == AuthStatus.SEND_CONTINUE || result == AuthStatus.SEND_FAILURE) {
+ return result;
+ }
+ throw new AuthException("Invalid AuthStatus " + result + " from server auth module secureResponse: " + serverAuthModule);
+ }
+ return AuthStatus.SEND_SUCCESS;
+ }
+
+ public AuthStatus validateRequest(MessageInfo messageInfo, Subject clientSubject, Subject serviceSubject) throws AuthException {
+ for (ServerAuthModule serverAuthModule : serverAuthModules) {
+ AuthStatus result = serverAuthModule.validateRequest(messageInfo, clientSubject, serviceSubject);
+
+ //jaspi spec p 88
+ if (result == AuthStatus.SUCCESS) {
+ continue;
+ }
+ if (result == AuthStatus.SEND_SUCCESS || result == AuthStatus.SEND_CONTINUE || result == AuthStatus.FAILURE) {
+ return result;
+ }
+ throw new AuthException("Invalid AuthStatus " + result + " from server auth module validateRequest: " + serverAuthModule);
+ }
+ return AuthStatus.SUCCESS;
+ }
+
+}
diff --git a/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/AuthModuleType.java b/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/AuthModuleType.java
index 3a1d065..20c490c 100644
--- a/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/AuthModuleType.java
+++ b/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/AuthModuleType.java
@@ -69,6 +69,7 @@
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "authModuleType", propOrder = {
"className",
+ "classLoaderName",
"requestPolicy",
"responsePolicy",
"options"
@@ -190,37 +191,4 @@
this.classLoaderName = 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>) 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();
- MessagePolicy respPolicy = responsePolicy == null? null: responsePolicy.newMessagePolicy();
- m.invoke(authModule, reqPolicy, respPolicy, callbackHandler, options);
- return authModule;
- }
- });
- } catch (PrivilegedActionException e) {
- Exception inner = e.getException();
- if (inner instanceof InstantiationException) {
- throw (AuthException) new AuthException("AuthConfigFactory error:"
- + inner.getCause().getMessage()).initCause(inner.getCause());
- } else {
- throw (AuthException) new AuthException("AuthConfigFactory error: " + inner).initCause(inner);
- }
- } catch (Exception e) {
- throw (AuthException) new AuthException("AuthConfigFactory error: " + e).initCause(e);
- }
-
-
-
- return authModule;
- }
-
}
diff --git a/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ClientAuthConfigType.java b/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ClientAuthConfigType.java
index dae6857..2447c22 100644
--- a/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ClientAuthConfigType.java
+++ b/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ClientAuthConfigType.java
@@ -25,11 +25,12 @@
package org.apache.geronimo.components.jaspi.model;
import java.io.Serializable;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
-import javax.security.auth.Subject;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.message.AuthException;
import javax.security.auth.message.MessageInfo;
@@ -38,8 +39,9 @@
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import org.apache.geronimo.components.jaspi.impl.ClientAuthConfigImpl;
/**
@@ -64,8 +66,9 @@
* </pre>
*
*
- * @version $Rev$ $Date$
+ * @version $Rev: 939768 $ $Date: 2010-04-30 11:26:46 -0700 (Fri, 30 Apr 2010) $
*/
+@XmlRootElement(name = "clientAuthConfig", namespace = "http://geronimo.apache.org/xml/ns/geronimo-jaspi")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "clientAuthConfigType", propOrder = {
"messageLayer",
@@ -85,8 +88,8 @@
@XmlElement(name = "protected")
protected boolean _protected;
//TODO go back to a map
- @XmlJavaTypeAdapter(KeyedObjectMapAdapter.class)
- protected Map<String, ClientAuthContextType> clientAuthContext;
+// @XmlJavaTypeAdapter(KeyedObjectMapAdapter.class)
+ protected List<ClientAuthContextType> clientAuthContext;
public ClientAuthConfigType() {
@@ -96,7 +99,7 @@
this.messageLayer = clientAuthContextType.getMessageLayer();
this.appContext = clientAuthContextType.getAppContext();
this.authenticationContextID = clientAuthContextType.getAuthenticationContextID();
- this.clientAuthContext = Collections.singletonMap(clientAuthContextType.getKey(), clientAuthContextType);
+ this.clientAuthContext = Collections.singletonList(clientAuthContextType);
this._protected = _protected;
}
@@ -216,11 +219,11 @@
*
* @return map of id to client auth context
*/
- public Map<String, ClientAuthContextType> getClientAuthContext() {
+ public List<ClientAuthContextType> getClientAuthContext() {
if (clientAuthContext == null) {
- clientAuthContext = new HashMap<String, ClientAuthContextType>();
+ clientAuthContext = new ArrayList<ClientAuthContextType>();
}
- return this.clientAuthContext;
+ return clientAuthContext;
}
@@ -229,7 +232,7 @@
if (authenticationContextID != null) {
return authenticationContextID;
}
- for (ClientAuthContextType clientAuthContextType: clientAuthContext.values()) {
+ for (ClientAuthContextType clientAuthContextType: clientAuthContext) {
String authContextID = clientAuthContextType.getAuthenticationContextID(messageInfo);
if (authContextID != null) {
return authContextID;
@@ -242,61 +245,4 @@
return ConfigProviderType.getRegistrationKey(messageLayer, appContext);
}
- public void initialize(CallbackHandler callbackHandler) throws AuthException {
- }
-
- public boolean isPersistent() {
- return true;
- }
-
- 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(callbackHandler);
- String authContextID = clientAuthContextType.getAuthenticationContextID();
- if (authContextID == null) {
- authContextID = getAuthenticationContextID();
- }
- if (!authContextMap.containsKey(authContextID)) {
- authContextMap.put(authContextID, clientAuthContext);
- }
- }
- }
- return new ClientAuthConfigImpl(this, authContextMap);
- }
-
- public static class ClientAuthConfigImpl implements ClientAuthConfig {
-
- private final ClientAuthConfigType clientAuthConfigType;
- private final Map<String, ClientAuthContext> clientAuthContextMap;
-
- public ClientAuthConfigImpl(ClientAuthConfigType clientAuthConfigType, Map<String, ClientAuthContext> clientAuthContextMap) {
- this.clientAuthConfigType = clientAuthConfigType;
- this.clientAuthContextMap = clientAuthContextMap;
- }
-
- public ClientAuthContext getAuthContext(String authContextID, Subject clientSubject, Map properties) throws AuthException {
- return clientAuthContextMap.get(authContextID);
- }
-
- public String getAppContext() {
- return clientAuthConfigType.getAppContext();
- }
-
- public String getAuthContextID(MessageInfo messageInfo) throws IllegalArgumentException {
- return clientAuthConfigType.getAuthContextID(messageInfo);
- }
-
- public String getMessageLayer() {
- return clientAuthConfigType.getMessageLayer();
- }
-
- public boolean isProtected() {
- return clientAuthConfigType.isProtected();
- }
-
- public void refresh() throws SecurityException {
- }
- }
}
diff --git a/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ClientAuthContextType.java b/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ClientAuthContextType.java
index 0eaaaba..ae06e62 100644
--- a/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ClientAuthContextType.java
+++ b/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ClientAuthContextType.java
@@ -29,17 +29,17 @@
import java.util.Collections;
import java.util.List;
-import javax.security.auth.Subject;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.message.AuthException;
-import javax.security.auth.message.AuthStatus;
import javax.security.auth.message.MessageInfo;
import javax.security.auth.message.config.ClientAuthContext;
import javax.security.auth.message.module.ClientAuthModule;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
+import org.apache.geronimo.components.jaspi.impl.ClientAuthContextImpl;
/**
@@ -62,8 +62,9 @@
* </complexType>
* </pre>
*
- * @version $Rev$ $Date$
+ * @version $Rev: 939768 $ $Date: 2010-04-30 11:26:46 -0700 (Fri, 30 Apr 2010) $
*/
+@XmlRootElement(name = "clientAuthContext", namespace = "http://geronimo.apache.org/xml/ns/geronimo-jaspi")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "clientAuthContextType", propOrder = {
"messageLayer",
@@ -72,7 +73,7 @@
"clientAuthModule"
})
public class ClientAuthContextType
- implements Serializable, KeyedObject {
+ implements Serializable {
private final static long serialVersionUID = 12343L;
protected String messageLayer;
@@ -186,83 +187,4 @@
}
- public String getKey() {
- return ConfigProviderType.getRegistrationKey(messageLayer, appContext);
- }
-
- public void initialize(CallbackHandler callbackHandler) throws AuthException {
- }
-
- public boolean isPersistent() {
- return true;
- }
-
- public ClientAuthContext newClientAuthContext(CallbackHandler callbackHandler) throws AuthException {
- List<ClientAuthModule> clientAuthModules = new ArrayList<ClientAuthModule>();
- for (AuthModuleType<ClientAuthModule> clientAuthModuleType: clientAuthModule) {
- ClientAuthModule instance = clientAuthModuleType.newAuthModule(callbackHandler);
- clientAuthModules.add(instance);
- }
- return new ClientAuthContextImpl(clientAuthModules);
- }
-
- public boolean match(String messageLayer, String appContext) {
- if (messageLayer == null) throw new NullPointerException("messageLayer");
- if (appContext == null) throw new NullPointerException("appContext");
- if (messageLayer.equals(this.messageLayer)) {
- return appContext.equals(this.appContext) || this.appContext == null;
- }
- if (this.messageLayer == null) {
- return appContext.equals(this.appContext) || this.appContext == null;
- }
- return false;
- }
-
- public static class ClientAuthContextImpl implements ClientAuthContext {
-
- private final List<ClientAuthModule> clientAuthModules;
-
- public ClientAuthContextImpl(List<ClientAuthModule> clientAuthModules) {
- this.clientAuthModules = clientAuthModules;
- }
-
- public void cleanSubject(MessageInfo messageInfo, Subject subject) throws AuthException {
- for (ClientAuthModule clientAuthModule : clientAuthModules) {
- clientAuthModule.cleanSubject(messageInfo, subject);
- }
- }
-
- public AuthStatus secureRequest(MessageInfo messageInfo, Subject clientSubject) throws AuthException {
- for (ClientAuthModule clientAuthModule : clientAuthModules) {
- AuthStatus result = clientAuthModule.secureRequest(messageInfo, clientSubject);
-
- //jaspi spec p 74
- if (result == AuthStatus.SUCCESS) {
- continue;
- }
- if (result == AuthStatus.SEND_CONTINUE || result == AuthStatus.FAILURE) {
- return result;
- }
- throw new AuthException("Invalid AuthStatus " + result + " from client auth module: " + clientAuthModule);
- }
- return AuthStatus.SUCCESS;
- }
-
- public AuthStatus validateResponse(MessageInfo messageInfo, Subject clientSubject, Subject serviceSubject) throws AuthException {
- for (ClientAuthModule clientAuthModule : clientAuthModules) {
- AuthStatus result = clientAuthModule.validateResponse(messageInfo, clientSubject, serviceSubject);
-
- //jaspi spec p 74
- if (result == AuthStatus.SUCCESS) {
- continue;
- }
- if (result == AuthStatus.SEND_CONTINUE || result == AuthStatus.FAILURE) {
- return result;
- }
- throw new AuthException("Invalid AuthStatus " + result + " from client auth module: " + clientAuthModule);
- }
- return AuthStatus.SUCCESS;
- }
- }
-
}
diff --git a/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ConfigProviderType.java b/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ConfigProviderType.java
index bb0ae86..452cfb7 100644
--- a/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ConfigProviderType.java
+++ b/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ConfigProviderType.java
@@ -35,18 +35,17 @@
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.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import org.apache.geronimo.components.jaspi.impl.ConfigProviderImpl;
import org.apache.geronimo.osgi.locator.ProviderLocator;
@@ -83,6 +82,7 @@
*
*
*/
+@XmlRootElement(name = "configProvider", namespace = "http://geronimo.apache.org/xml/ns/geronimo-jaspi")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "configProviderType", propOrder = {
"messageLayer",
@@ -96,7 +96,7 @@
"classLoaderName"
})
public class ConfigProviderType
- implements AuthConfigFactory.RegistrationContext, Serializable, KeyedObject
+ implements Serializable
{
private final static long serialVersionUID = 12343L;
@@ -108,20 +108,11 @@
@XmlElement(required = true)
@XmlJavaTypeAdapter(StringMapAdapter.class)
protected Map<String, String> properties;
- @XmlJavaTypeAdapter(KeyedObjectMapAdapter.class)
- private Map<String, ClientAuthConfigType> clientAuthConfig;
- @XmlJavaTypeAdapter(KeyedObjectMapAdapter.class)
- private Map<String, ServerAuthConfigType> serverAuthConfig;
+ private List<ClientAuthConfigType> clientAuthConfig;
+ private List<ServerAuthConfigType> serverAuthConfig;
protected Boolean persistent = Boolean.FALSE;
protected String classLoaderName;
- @XmlTransient
- private AuthConfigFactory authConfigFactory;
- @XmlTransient
- private final List<RegistrationListener> listeners = new ArrayList<RegistrationListener>();
- @XmlTransient
- private AuthConfigProvider provider;
-
public ConfigProviderType() {
}
@@ -130,7 +121,6 @@
this.messageLayer = messageLayer;
this.appContext = appContext;
this.persistent = persistent;
- this.authConfigFactory = authConfigFactory;
}
/**
@@ -275,11 +265,11 @@
*
* @return map of id to client auth config
*/
- public Map<String, ClientAuthConfigType> getClientAuthConfig() {
+ public List<ClientAuthConfigType> getClientAuthConfig() {
if (clientAuthConfig == null) {
- clientAuthConfig = new HashMap<String, ClientAuthConfigType>();
+ clientAuthConfig = new ArrayList<ClientAuthConfigType>();
}
- return this.clientAuthConfig;
+ return clientAuthConfig;
}
/**
@@ -304,11 +294,11 @@
*
* @return map of id to server auth config
*/
- public Map<String, ServerAuthConfigType> getServerAuthConfig() {
+ public List<ServerAuthConfigType> getServerAuthConfig() {
if (serverAuthConfig == null) {
- serverAuthConfig = new HashMap<String, ServerAuthConfigType>();
+ serverAuthConfig = new ArrayList<ServerAuthConfigType>();
}
- return this.serverAuthConfig;
+ return serverAuthConfig;
}
/**
@@ -335,18 +325,6 @@
this.persistent = value;
}
- public List<RegistrationListener> getListeners() {
- return listeners;
- }
-
- public AuthConfigProvider getProvider() {
- return provider;
- }
-
- public void setProvider(AuthConfigProvider provider) {
- this.provider = provider;
- }
-
public String getClassLoaderName() {
return classLoaderName;
}
@@ -355,33 +333,6 @@
this.classLoaderName = classLoaderName;
}
- public void initialize(CallbackHandler callbackHandler) {
- if (className == null) {
- provider = new ConfigProviderImpl(getClientAuthConfig(), getServerAuthConfig());
- } else {
- try {
- provider = java.security.AccessController
- .doPrivileged(new PrivilegedExceptionAction<AuthConfigProvider>() {
- public AuthConfigProvider run() throws ClassNotFoundException, SecurityException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException {
- 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);
- }
- });
- } catch (PrivilegedActionException e) {
- Exception inner = e.getException();
- if (inner instanceof InstantiationException) {
- throw new SecurityException("AuthConfigFactory error:"
- + inner.getCause().getMessage(), inner.getCause());
- } else {
- throw new SecurityException("AuthConfigFactory error: " + inner, inner);
- }
- } catch (Exception e) {
- throw new SecurityException("AuthConfigFactory error: " + e, e);
- }
- }
- }
-
public static String getRegistrationKey(String layer, String appContext) {
return layer + "/" + appContext;
}
@@ -390,75 +341,4 @@
return getRegistrationKey(getMessageLayer(), getAppContext());
}
- public static class ConfigProviderImpl implements AuthConfigProvider {
-
- private final Map<String, ClientAuthConfigType> clientConfigTypeMap;
- private final Map<String, ServerAuthConfigType> serverAuthConfigMap;
-
- public ConfigProviderImpl(Map<String, ClientAuthConfigType> clientConfigTypeMap, Map<String, ServerAuthConfigType> serverAuthConfigMap) {
- this.clientConfigTypeMap = clientConfigTypeMap;
- this.serverAuthConfigMap = serverAuthConfigMap;
- }
-
- /**
- * spec required constructor
- * @param properties useless properties map
- * @param factory useless factory
- */
- public ConfigProviderImpl(Map<String, String> properties, AuthConfigFactory factory) {
- throw new RuntimeException("don't call this");
- }
-
- public ClientAuthConfig getClientAuthConfig(String layer, String appContext, CallbackHandler handler) throws AuthException, SecurityException {
- if (layer == null) {
- throw new NullPointerException("messageLayer");
- }
- if (appContext == null) {
- throw new NullPointerException("appContext");
- }
- ClientAuthConfigType ctx = clientConfigTypeMap.get(getRegistrationKey(layer, appContext));
- if (ctx == null) {
- ctx = clientConfigTypeMap.get(getRegistrationKey(null, appContext));
- }
- if (ctx == null) {
- ctx = clientConfigTypeMap.get(getRegistrationKey(layer, null));
- }
- if (ctx == null) {
- ctx = clientConfigTypeMap.get(getRegistrationKey(null, null));
- }
- if (ctx != null) {
-
- return ctx.newClientAuthConfig(layer, appContext, handler);
- }
- throw new AuthException("No suitable ClientAuthConfig");
- }
-
- public ServerAuthConfig getServerAuthConfig(String layer, String appContext, CallbackHandler handler) throws AuthException, SecurityException {
- if (layer == null) {
- throw new NullPointerException("messageLayer");
- }
- if (appContext == null) {
- throw new NullPointerException("appContext");
- }
- ServerAuthConfigType ctx = serverAuthConfigMap.get(getRegistrationKey(layer, appContext));
- if (ctx == null) {
- ctx = serverAuthConfigMap.get(getRegistrationKey(null, appContext));
- }
- if (ctx == null) {
- ctx = serverAuthConfigMap.get(getRegistrationKey(layer, null));
- }
- if (ctx == null) {
- ctx = serverAuthConfigMap.get(getRegistrationKey(null, null));
- }
- if (ctx != null) {
-
- return ctx.newServerAuthConfig(layer, appContext, handler);
- }
- throw new AuthException("No suitable ServerAuthConfig");
- }
-
- public void refresh() throws SecurityException {
- }
- }
-
}
diff --git a/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/JaspiType.java b/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/JaspiType.java
index 1c07b16..1e174bd 100644
--- a/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/JaspiType.java
+++ b/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/JaspiType.java
@@ -25,7 +25,9 @@
package org.apache.geronimo.components.jaspi.model;
import java.io.Serializable;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import javax.xml.bind.annotation.XmlAccessType;
@@ -52,7 +54,7 @@
* </pre>
*
*
- * @version $Rev$ $Date$
+ * @version $Rev: 939768 $ $Date: 2010-04-30 11:26:46 -0700 (Fri, 30 Apr 2010) $
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "jaspiType", propOrder = {
@@ -63,9 +65,9 @@
{
private final static long serialVersionUID = 12343L;
-
- @XmlJavaTypeAdapter(KeyedObjectMapAdapter.class)
- protected Map<String, ConfigProviderType> configProvider;
+ protected List<ConfigProviderType> configProvider;
+// @XmlJavaTypeAdapter(KeyedObjectMapAdapter.class)
+// protected Map<String, ConfigProviderType> configProvider;
/**
* Gets the value of the configProvider property.
@@ -88,11 +90,11 @@
* {@link ConfigProviderType }
*
*
- * @return map of id to Config Provider
+ * @return list of Config Provider
*/
- public Map<String, ConfigProviderType> getConfigProvider() {
+ public List<ConfigProviderType> getConfigProvider() {
if (configProvider == null) {
- configProvider = new HashMap<String, ConfigProviderType>();
+ configProvider = new ArrayList<ConfigProviderType>();
}
return this.configProvider;
}
diff --git a/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/JaspiUtil.java b/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/JaspiUtil.java
index bbe212f..241bf57 100644
--- a/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/JaspiUtil.java
+++ b/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/JaspiUtil.java
@@ -21,16 +21,18 @@
package org.apache.geronimo.components.jaspi.model;
import java.util.Collections;
+import java.util.List;
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 org.apache.geronimo.components.jaspi.impl.ConfigProviderImpl;
/**
* Convenience methods to wrap various jaspi objects into AuthConfigProvider instances, ready to be registered.
- * @version $Rev$ $Date$
+ * @version $Rev: 939768 $ $Date: 2010-04-30 11:26:46 -0700 (Fri, 30 Apr 2010) $
*/
public class JaspiUtil {
@@ -38,12 +40,12 @@
}
public static AuthConfigProvider wrapAuthConfigProvider(ConfigProviderType configProviderType) {
- return new ConfigProviderType.ConfigProviderImpl(configProviderType.getClientAuthConfig(), configProviderType.getServerAuthConfig());
+ return new ConfigProviderImpl(configProviderType.getClientAuthConfig(), configProviderType.getServerAuthConfig());
}
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());
+ List<ClientAuthConfigType> clientAuthConfig = Collections.singletonList(clientAuthConfigType);
+ return new ConfigProviderImpl(clientAuthConfig, Collections.<ServerAuthConfigType>emptyList());
}
public static AuthConfigProvider wrapClientAuthContext(ClientAuthContextType clientAuthContextType, boolean _protected) throws AuthException {
@@ -58,8 +60,8 @@
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);
+ List<ServerAuthConfigType> serverAuthConfig = Collections.singletonList(serverAuthConfigType);
+ return new ConfigProviderImpl(Collections.<ClientAuthConfigType>emptyList(), serverAuthConfig);
}
public static AuthConfigProvider wrapServerAuthContext(ServerAuthContextType serverAuthContextType, boolean _protected) throws AuthException {
diff --git a/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/JaspiXmlUtil.java b/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/JaspiXmlUtil.java
index 0c2f9df..90ece51 100644
--- a/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/JaspiXmlUtil.java
+++ b/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/JaspiXmlUtil.java
@@ -23,7 +23,6 @@
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;
@@ -40,7 +39,7 @@
import org.xml.sax.SAXException;
/**
- * @version $Rev$ $Date$
+ * @version $Rev: 939768 $ $Date: 2010-04-30 11:26:46 -0700 (Fri, 30 Apr 2010) $
*/
public class JaspiXmlUtil {
public static final XMLInputFactory XMLINPUT_FACTORY = XMLInputFactory.newInstance();
@@ -49,8 +48,8 @@
static {
try {
-// JASPI_CONTEXT = JAXBContext.newInstance(JaspiType.class);
- JASPI_CONTEXT = com.envoisolutions.sxc.jaxb.JAXBContextImpl.newInstance(new Class[] {JaspiType.class, ConfigProviderType.class, ClientAuthConfigType.class, ClientAuthContextType.class, ServerAuthConfigType.class, ServerAuthContextType.class, AuthModuleType.class}, Collections.singletonMap("com.envoisolutions.sxc.generate", "false"));
+ JASPI_CONTEXT = JAXBContext.newInstance(JaspiType.class, ConfigProviderType.class, ClientAuthConfigType.class, ClientAuthContextType.class, ServerAuthConfigType.class, ServerAuthContextType.class, AuthModuleType.class);
+// JASPI_CONTEXT = com.envoisolutions.sxc.jaxb.JAXBContextImpl.newInstance(new Class[] {JaspiType.class, ConfigProviderType.class, ClientAuthConfigType.class, ClientAuthContextType.class, ServerAuthConfigType.class, ServerAuthContextType.class, AuthModuleType.class}, Collections.singletonMap("com.envoisolutions.sxc.generate", "false"));
} catch (JAXBException e) {
throw new RuntimeException("Could not create jaxb contexts for plugin types", e);
diff --git a/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/KeyedObject.java b/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/KeyedObject.java
index 822899b..374bf21 100644
--- a/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/KeyedObject.java
+++ b/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/KeyedObject.java
@@ -24,10 +24,8 @@
import javax.security.auth.message.AuthException;
/**
- * @version $Rev$ $Date$
+ * @version $Rev: 939768 $ $Date: 2010-04-30 11:26:46 -0700 (Fri, 30 Apr 2010) $
*/
public interface KeyedObject {
String getKey();
- void initialize(CallbackHandler callbackHandler) throws AuthException;
- boolean isPersistent();
}
diff --git a/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/KeyedObjectMapAdapter.java b/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/KeyedObjectMapAdapter.java
index 0630532..f88421e 100644
--- a/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/KeyedObjectMapAdapter.java
+++ b/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/KeyedObjectMapAdapter.java
@@ -30,47 +30,43 @@
import javax.xml.bind.annotation.adapters.XmlAdapter;
/**
- * @version $Rev$ $Date$
+ * @version $Rev: 939768 $ $Date: 2010-04-30 11:26:46 -0700 (Fri, 30 Apr 2010) $
*/
-public class KeyedObjectMapAdapter<T extends KeyedObject> extends XmlAdapter<T[], Map<String, T>> {
+public class KeyedObjectMapAdapter<T extends KeyedObject> extends XmlAdapter<List<T>, Map<String, T>> {
public static CallbackHandler staticCallbackHandler;
private final CallbackHandler callbackHandler;
- private final Class<T> type;
+// private final Class<T> type;
- public KeyedObjectMapAdapter(CallbackHandler callbackHandler, Class<T> type) {
+ public KeyedObjectMapAdapter(CallbackHandler callbackHandler) {
this.callbackHandler = callbackHandler;
- this.type = type;
+// this.type = type;
}
- public KeyedObjectMapAdapter(Class<T> type) {
- this(staticCallbackHandler, type);
+ public KeyedObjectMapAdapter() {
+ this(staticCallbackHandler);
}
- public Map<String, T> unmarshal(T[] configProviderTypes) throws Exception {
+ public Map<String, T> unmarshal(List<T> configProviderTypes) throws Exception {
Map<String, T> map = new HashMap<String, T>();
if (configProviderTypes != null) {
for (T configProviderType : configProviderTypes) {
if (configProviderType != null) {
String key = configProviderType.getKey();
map.put(key, configProviderType);
- configProviderType.initialize(callbackHandler);
}
}
}
return map;
}
- public T[] marshal(Map<String, T> stringConfigProviderTypeMap) throws Exception {
+ public ArrayList<T> marshal(Map<String, T> stringConfigProviderTypeMap) throws Exception {
if (stringConfigProviderTypeMap == null) {
return null;
}
- List<T> list = new ArrayList<T>();
+ ArrayList<T> list = new ArrayList<T>();
for (T configProviderType : stringConfigProviderTypeMap.values()) {
- if (configProviderType.isPersistent()) {
- list.add(configProviderType);
- }
+ list.add(configProviderType);
}
- T[] array = (T[]) Array.newInstance(type, list.size());
- return list.toArray(array);
+ return list;
}
}
diff --git a/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/MessagePolicyType.java b/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/MessagePolicyType.java
index c8c3df6..3042389 100644
--- a/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/MessagePolicyType.java
+++ b/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/MessagePolicyType.java
@@ -55,7 +55,7 @@
* </pre>
*
*
- * @version $Rev$ $Date$
+ * @version $Rev: 939768 $ $Date: 2010-04-30 11:26:46 -0700 (Fri, 30 Apr 2010) $
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "messagePolicyType", propOrder = {
@@ -124,16 +124,5 @@
this.mandatory = value;
}
- 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();
- }
- return new MessagePolicy(targetPolicies, mandatory);
- }
}
diff --git a/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ProtectionPolicyType.java b/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ProtectionPolicyType.java
index ada31f6..f838d9a 100644
--- a/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ProtectionPolicyType.java
+++ b/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ProtectionPolicyType.java
@@ -57,7 +57,7 @@
* </pre>
*
*
- * @version $Rev$ $Date$
+ * @version $Rev: 939768 $ $Date: 2010-04-30 11:26:46 -0700 (Fri, 30 Apr 2010) $
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "protectionPolicyType", propOrder = {
@@ -95,27 +95,4 @@
this.className = value;
}
- 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 = 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;
- }
- });
- } catch (PrivilegedActionException e) {
- Exception inner = e.getException();
- if (inner instanceof InstantiationException) {
- throw (AuthException) new AuthException("AuthConfigFactory error:"
- + inner.getCause().getMessage()).initCause(inner.getCause());
- } else {
- throw (AuthException) new AuthException("AuthConfigFactory error: " + inner).initCause(inner);
- }
- } catch (Exception e) {
- throw (AuthException) new AuthException("AuthConfigFactory error: " + e).initCause(e);
- }
- }
}
diff --git a/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ServerAuthConfigType.java b/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ServerAuthConfigType.java
index eae7874..483a742 100644
--- a/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ServerAuthConfigType.java
+++ b/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ServerAuthConfigType.java
@@ -25,8 +25,10 @@
package org.apache.geronimo.components.jaspi.model;
import java.io.Serializable;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import javax.security.auth.Subject;
@@ -39,7 +41,7 @@
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import org.apache.geronimo.components.jaspi.impl.ServerAuthConfigImpl;
/**
@@ -64,7 +66,7 @@
* </pre>
*
*
- * @version $Rev$ $Date$
+ * @version $Rev: 939768 $ $Date: 2010-04-30 11:26:46 -0700 (Fri, 30 Apr 2010) $
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "serverAuthConfigType", propOrder = {
@@ -84,8 +86,8 @@
protected String authenticationContextID;
@XmlElement(name = "protected")
protected boolean _protected;
- @XmlJavaTypeAdapter(KeyedObjectMapAdapter.class)
- protected Map<String, ServerAuthContextType> serverAuthContext;
+// @XmlJavaTypeAdapter(KeyedObjectMapAdapter.class)
+ protected List<ServerAuthContextType> serverAuthContext;
public ServerAuthConfigType() {
}
@@ -94,7 +96,7 @@
this.messageLayer = serverAuthContextType.getMessageLayer();
this.appContext = serverAuthContextType.getAppContext();
this.authenticationContextID = serverAuthContextType.getAuthenticationContextID();
- this.serverAuthContext = Collections.singletonMap(serverAuthContextType.getKey(), serverAuthContextType);
+ this.serverAuthContext = Collections.singletonList(serverAuthContextType);
this._protected = _protected;
}
@@ -138,7 +140,7 @@
if (authenticationContextID != null) {
return authenticationContextID;
}
- for (ServerAuthContextType serverAuthContextType: serverAuthContext.values()) {
+ for (ServerAuthContextType serverAuthContextType: serverAuthContext) {
String authContextID = serverAuthContextType.getAuthenticationContextID(messageInfo);
if (authContextID != null) {
return authContextID;
@@ -227,81 +229,15 @@
*
* @return map of id to Server auth config
*/
- public Map<String, ServerAuthContextType> getServerAuthContext() {
+ public List<ServerAuthContextType> getServerAuthContext() {
if (serverAuthContext == null) {
- serverAuthContext = new HashMap<String, ServerAuthContextType>();
+ serverAuthContext = new ArrayList<ServerAuthContextType>();
}
- return this.serverAuthContext;
+ return serverAuthContext;
}
- public ServerAuthContext getAuthContext(String authContextID, Subject serviceSubject, Map properties) throws AuthException {
- //see page 136 We are going to ignore the clientSubject and properties for now.
- for (ServerAuthContextType serverAuthContext: getServerAuthContext().values()) {
- if (serverAuthContext.getAuthenticationContextID().equals(authContextID)) {
- return serverAuthContext.getServerAuthContext();
- }
- }
- return null;
- }
public String getKey() {
return ConfigProviderType.getRegistrationKey(messageLayer, appContext);
}
- public void initialize(CallbackHandler callbackHandler) throws AuthException {
- }
-
- public boolean isPersistent() {
- return true;
- }
-
- 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(callbackHandler);
- String authContextID = serverAuthContextType.getAuthenticationContextID();
- if (authContextID == null) {
- authContextID = getAuthenticationContextID();
- }
- if (!authContextMap.containsKey(authContextID)) {
- authContextMap.put(authContextID, serverAuthContext);
- }
- }
- }
- return new ServerAuthConfigImpl(this, authContextMap);
- }
-
- public static class ServerAuthConfigImpl implements ServerAuthConfig {
-
- private final ServerAuthConfigType serverAuthConfigType;
- private final Map<String, ServerAuthContext> serverAuthContextMap;
-
- public ServerAuthConfigImpl(ServerAuthConfigType serverAuthConfigType, Map<String, ServerAuthContext> serverAuthContextMap) {
- this.serverAuthConfigType = serverAuthConfigType;
- this.serverAuthContextMap = serverAuthContextMap;
- }
-
- public ServerAuthContext getAuthContext(String authContextID, Subject serverSubject, Map properties) throws AuthException {
- return serverAuthContextMap.get(authContextID);
- }
-
- public String getAppContext() {
- return serverAuthConfigType.getAppContext();
- }
-
- public String getAuthContextID(MessageInfo messageInfo) throws IllegalArgumentException {
- return serverAuthConfigType.getAuthContextID(messageInfo);
- }
-
- public String getMessageLayer() {
- return serverAuthConfigType.getMessageLayer();
- }
-
- public boolean isProtected() {
- return serverAuthConfigType.isProtected();
- }
-
- public void refresh() throws SecurityException {
- }
- }
}
diff --git a/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ServerAuthContextType.java b/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ServerAuthContextType.java
index ba7fcf3..5c57955 100644
--- a/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ServerAuthContextType.java
+++ b/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ServerAuthContextType.java
@@ -29,10 +29,8 @@
import java.util.Collections;
import java.util.List;
-import javax.security.auth.Subject;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.message.AuthException;
-import javax.security.auth.message.AuthStatus;
import javax.security.auth.message.MessageInfo;
import javax.security.auth.message.config.ServerAuthContext;
import javax.security.auth.message.module.ServerAuthModule;
@@ -40,6 +38,7 @@
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
+import org.apache.geronimo.components.jaspi.impl.ServerAuthContextImpl;
/**
@@ -63,7 +62,7 @@
* </pre>
*
*
- * @version $Rev$ $Date$
+ * @version $Rev: 939768 $ $Date: 2010-04-30 11:26:46 -0700 (Fri, 30 Apr 2010) $
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "serverAuthContextType", propOrder = {
@@ -73,7 +72,7 @@
"serverAuthModule"
})
public class ServerAuthContextType
- implements Serializable, KeyedObject {
+ implements Serializable {
private final static long serialVersionUID = 12343L;
protected String messageLayer;
@@ -81,10 +80,6 @@
protected String authenticationContextID;
protected List<AuthModuleType<ServerAuthModule>> serverAuthModule;
- @XmlTransient
- private ServerAuthContext serverAuthContext;
-
-
public ServerAuthContextType() {
}
@@ -187,94 +182,4 @@
return this.serverAuthModule;
}
- public String getKey() {
- return ConfigProviderType.getRegistrationKey(messageLayer, appContext);
- }
-
- public void initialize(CallbackHandler callbackHandler) throws AuthException {
- List<ServerAuthModule> serverAuthModules = new ArrayList<ServerAuthModule>();
- for (AuthModuleType<ServerAuthModule> serverAuthModuleType: serverAuthModule) {
- ServerAuthModule instance = serverAuthModuleType.newAuthModule(callbackHandler);
- serverAuthModules.add(instance);
- }
- serverAuthContext = new ServerAuthContextImpl(serverAuthModules);
- }
-
- public boolean isPersistent() {
- return true;
- }
-
- public ServerAuthContext getServerAuthContext() {
- return serverAuthContext;
- }
-
- public ServerAuthContext newServerAuthContext(CallbackHandler callbackHandler) throws AuthException {
- List<ServerAuthModule> serverAuthModules = new ArrayList<ServerAuthModule>();
- for (AuthModuleType<ServerAuthModule> serverAuthModuleType: serverAuthModule) {
- ServerAuthModule instance = serverAuthModuleType.newAuthModule(callbackHandler);
- serverAuthModules.add(instance);
- }
- return new ServerAuthContextImpl(serverAuthModules);
- }
-
- public boolean match(String messageLayer, String appContext) {
- if (messageLayer == null) throw new NullPointerException("messageLayer");
- if (appContext == null) throw new NullPointerException("appContext");
- if (messageLayer.equals(this.messageLayer)) {
- return appContext.equals(this.appContext) || this.appContext == null;
- }
- if (this.messageLayer == null) {
- return appContext.equals(this.appContext) || this.appContext == null;
- }
- return false;
- }
-
- public static class ServerAuthContextImpl implements ServerAuthContext {
-
- private final List<ServerAuthModule> serverAuthModules;
-
- public ServerAuthContextImpl(List<ServerAuthModule> serverAuthModules) {
- this.serverAuthModules = serverAuthModules;
- }
-
- public void cleanSubject(MessageInfo messageInfo, Subject subject) throws AuthException {
- for (ServerAuthModule serverAuthModule : serverAuthModules) {
- serverAuthModule.cleanSubject(messageInfo, subject);
- }
- }
-
- public AuthStatus secureResponse(MessageInfo messageInfo, Subject serviceSubject) throws AuthException {
- for (ServerAuthModule serverAuthModule : serverAuthModules) {
- AuthStatus result = serverAuthModule.secureResponse(messageInfo, serviceSubject);
-
- //jaspi spec p 86
- if (result == AuthStatus.SEND_SUCCESS) {
- continue;
- }
- if (result == AuthStatus.SEND_CONTINUE || result == AuthStatus.SEND_FAILURE) {
- return result;
- }
- throw new AuthException("Invalid AuthStatus " + result + " from server auth module secureResponse: " + serverAuthModule);
- }
- return AuthStatus.SEND_SUCCESS;
- }
-
- public AuthStatus validateRequest(MessageInfo messageInfo, Subject clientSubject, Subject serviceSubject) throws AuthException {
- for (ServerAuthModule serverAuthModule : serverAuthModules) {
- AuthStatus result = serverAuthModule.validateRequest(messageInfo, clientSubject, serviceSubject);
-
- //jaspi spec p 88
- if (result == AuthStatus.SUCCESS) {
- continue;
- }
- if (result == AuthStatus.SEND_SUCCESS || result == AuthStatus.SEND_CONTINUE || result == AuthStatus.FAILURE) {
- return result;
- }
- throw new AuthException("Invalid AuthStatus " + result + " from server auth module validateRequest: " + serverAuthModule);
- }
- return AuthStatus.SUCCESS;
- }
-
- }
-
}
diff --git a/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/StringMapAdapter.java b/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/StringMapAdapter.java
index 4000057..ca19bac 100644
--- a/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/StringMapAdapter.java
+++ b/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/StringMapAdapter.java
@@ -31,7 +31,7 @@
/**
* jaxb helper class for maps
*
- * @version $Rev$ $Date$
+ * @version $Rev: 939768 $ $Date: 2010-04-30 11:26:46 -0700 (Fri, 30 Apr 2010) $
*/
public class StringMapAdapter extends XmlAdapter<String, Map<String, String>> {
public Map<String, String> unmarshal(String s) throws Exception {
diff --git a/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/TargetPolicyType.java b/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/TargetPolicyType.java
index 04dc719..2a0d233 100644
--- a/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/TargetPolicyType.java
+++ b/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/TargetPolicyType.java
@@ -55,7 +55,7 @@
* </pre>
*
*
- * @version $Rev$ $Date$
+ * @version $Rev: 939768 $ $Date: 2010-04-30 11:26:46 -0700 (Fri, 30 Apr 2010) $
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "targetPolicyType", propOrder = {
@@ -125,12 +125,4 @@
return this.target;
}
- 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();
- }
- return new MessagePolicy.TargetPolicy(targets, protectionPolicy.newProtectionPolicy());
- }
}
diff --git a/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/TargetType.java b/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/TargetType.java
index 1fa425d..0570282 100644
--- a/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/TargetType.java
+++ b/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/TargetType.java
@@ -57,7 +57,7 @@
* </pre>
*
*
- * @version $Rev$ $Date$
+ * @version $Rev: 939768 $ $Date: 2010-04-30 11:26:46 -0700 (Fri, 30 Apr 2010) $
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "targetType", propOrder = {
@@ -95,29 +95,4 @@
this.className = value;
}
- 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 = 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;
- }
- });
- } catch (PrivilegedActionException e) {
- Exception inner = e.getException();
- if (inner instanceof InstantiationException) {
- throw (AuthException) new AuthException("AuthConfigFactory error:"
- + inner.getCause().getMessage()).initCause(inner.getCause());
- } else {
- throw (AuthException) new AuthException("AuthConfigFactory error: " + inner).initCause(inner);
- }
- } catch (Exception e) {
- throw (AuthException) new AuthException("AuthConfigFactory error: " + e).initCause(e);
- }
-
- }
-
}
diff --git a/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/package-info.java b/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/package-info.java
index 969a8a6..857f0dd 100644
--- a/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/package-info.java
+++ b/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/package-info.java
@@ -21,7 +21,7 @@
// Generated on: 2008.07.15 at 04:13:34 PM PDT
//
/**
- * @version $Rev$ $Date$
+ * @version $Rev: 680565 $ $Date: 2008-07-28 16:33:51 -0700 (Mon, 28 Jul 2008) $
*/
@javax.xml.bind.annotation.XmlSchema(namespace = "http://geronimo.apache.org/xml/ns/geronimo-jaspi", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
package org.apache.geronimo.components.jaspi.model;
diff --git a/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/AuthModuleTypeJAXB.java b/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/AuthModuleTypeJAXB.java
deleted file mode 100644
index 21f8e8a..0000000
--- a/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/AuthModuleTypeJAXB.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/**
- * 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 sxc.org.apache.geronimo.components.jaspi.model;
-
-import java.util.Map;
-import javax.xml.XMLConstants;
-import javax.xml.namespace.QName;
-import javax.security.auth.message.module.ClientAuthModule;
-import javax.security.auth.message.module.ServerAuthModule;
-
-import com.envoisolutions.sxc.jaxb.FieldAccessor;
-import com.envoisolutions.sxc.jaxb.JAXBObject;
-import com.envoisolutions.sxc.jaxb.LifecycleCallback;
-import com.envoisolutions.sxc.jaxb.RuntimeContext;
-import com.envoisolutions.sxc.util.Attribute;
-import com.envoisolutions.sxc.util.XoXMLStreamReader;
-import com.envoisolutions.sxc.util.XoXMLStreamWriter;
-import org.apache.geronimo.components.jaspi.model.AuthModuleType;
-import org.apache.geronimo.components.jaspi.model.MessagePolicyType;
-import org.apache.geronimo.components.jaspi.model.StringMapAdapter;
-
-
-import static sxc.org.apache.geronimo.components.jaspi.model.MessagePolicyTypeJAXB.readMessagePolicyType;
-import static sxc.org.apache.geronimo.components.jaspi.model.MessagePolicyTypeJAXB.writeMessagePolicyType;
-
-/**
- * @version $Rev: $ $Date: $
- */
-
-@SuppressWarnings({
- "StringEquality"
-})
-public class AuthModuleTypeJAXB<T>
- extends JAXBObject<AuthModuleType>
-{
-
- public final static AuthModuleTypeJAXB<ClientAuthModule> CLIENT_INSTANCE = new AuthModuleTypeJAXB<ClientAuthModule>();
- public final static AuthModuleTypeJAXB<ServerAuthModule> SERVER_INSTANCE = new AuthModuleTypeJAXB<ServerAuthModule>();
- private final static LifecycleCallback lifecycleCallback = new LifecycleCallback(AuthModuleType.class);
- private final static FieldAccessor<AuthModuleType, String> authModuleTypeClassName = new FieldAccessor<AuthModuleType, String>(AuthModuleType.class, "className");
- private final static FieldAccessor<AuthModuleType, String> authModuleTypeClassLoaderName = new FieldAccessor<AuthModuleType, String>(AuthModuleType.class, "classLoaderName");
- private final static FieldAccessor<AuthModuleType, MessagePolicyType> authModuleTypeRequestPolicy = new FieldAccessor<AuthModuleType, MessagePolicyType>(AuthModuleType.class, "requestPolicy");
- private final static FieldAccessor<AuthModuleType, MessagePolicyType> authModuleTypeResponsePolicy = new FieldAccessor<AuthModuleType, MessagePolicyType>(AuthModuleType.class, "responsePolicy");
- private final static FieldAccessor<AuthModuleType, Map<String, String>> authModuleTypeOptions = new FieldAccessor<AuthModuleType, Map<String, String>>(AuthModuleType.class, "options");
- private final static StringMapAdapter stringMapAdapterAdapter = new StringMapAdapter();
-
- public AuthModuleTypeJAXB() {
- super(AuthModuleType.class, null, new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi".intern(), "authModuleType".intern()), MessagePolicyTypeJAXB.class);
- }
-
- public static AuthModuleType<ClientAuthModule> readClientAuthModuleType(XoXMLStreamReader reader, RuntimeContext context)
- throws Exception
- {
- return CLIENT_INSTANCE.read(reader, context);
- }
-
- public static void writeClientAuthModuleType(XoXMLStreamWriter writer, AuthModuleType authModuleType, RuntimeContext context)
- throws Exception
- {
- CLIENT_INSTANCE.write(writer, authModuleType, context);
- }
-
- public static AuthModuleType<ServerAuthModule> readServerAuthModuleType(XoXMLStreamReader reader, RuntimeContext context)
- throws Exception
- {
- return SERVER_INSTANCE.read(reader, context);
- }
-
- public static void writeServerAuthModuleType(XoXMLStreamWriter writer, AuthModuleType authModuleType, RuntimeContext context)
- throws Exception
- {
- SERVER_INSTANCE.write(writer, authModuleType, context);
- }
-
- public final AuthModuleType<T> read(XoXMLStreamReader reader, RuntimeContext context)
- throws Exception
- {
- // Check for xsi:nil
- if (reader.isXsiNil()) {
- return null;
- }
-
- if (context == null) {
- context = new RuntimeContext();
- }
-
- AuthModuleType<T> authModuleType = new AuthModuleType<T>();
- context.beforeUnmarshal(authModuleType, lifecycleCallback);
-
-
- // Check xsi:type
- QName xsiType = reader.getXsiType();
- if (xsiType!= null) {
- if (("authModuleType"!= xsiType.getLocalPart())||("http://geronimo.apache.org/xml/ns/geronimo-jaspi"!= xsiType.getNamespaceURI())) {
- return context.unexpectedXsiType(reader, AuthModuleType.class);
- }
- }
-
- // Read attributes
- for (Attribute attribute: reader.getAttributes()) {
- if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) {
- context.unexpectedAttribute(attribute);
- }
- }
-
- // Read elements
- for (XoXMLStreamReader elementReader: reader.getChildElements()) {
- if (("className" == elementReader.getLocalName())&&("http://geronimo.apache.org/xml/ns/geronimo-jaspi" == elementReader.getNamespaceURI())) {
- // ELEMENT: className
- String className = elementReader.getElementAsString();
- authModuleTypeClassName.setObject(reader, context, authModuleType, className);
- } else if (("classLoaderName" == elementReader.getLocalName())&&("http://geronimo.apache.org/xml/ns/geronimo-jaspi" == elementReader.getNamespaceURI())) {
- // ELEMENT: classLoaderName
- String classLoaderName = elementReader.getElementAsString();
- authModuleTypeClassLoaderName.setObject(reader, context, authModuleType, classLoaderName);
- } else if (("requestPolicy" == elementReader.getLocalName())&&("http://geronimo.apache.org/xml/ns/geronimo-jaspi" == elementReader.getNamespaceURI())) {
- // ELEMENT: requestPolicy
- MessagePolicyType requestPolicy = readMessagePolicyType(elementReader, context);
- authModuleTypeRequestPolicy.setObject(reader, context, authModuleType, requestPolicy);
- } else if (("responsePolicy" == elementReader.getLocalName())&&("http://geronimo.apache.org/xml/ns/geronimo-jaspi" == elementReader.getNamespaceURI())) {
- // ELEMENT: responsePolicy
- MessagePolicyType responsePolicy = readMessagePolicyType(elementReader, context);
- authModuleTypeResponsePolicy.setObject(reader, context, authModuleType, responsePolicy);
- } else if (("options" == elementReader.getLocalName())&&("http://geronimo.apache.org/xml/ns/geronimo-jaspi" == elementReader.getNamespaceURI())) {
- // ELEMENT: options
- String optionsRaw = elementReader.getElementAsString();
-
- Map<String, String> options;
- try {
- options = stringMapAdapterAdapter.unmarshal(optionsRaw);
- } catch (Exception e) {
- context.xmlAdapterError(elementReader, StringMapAdapter.class, Map.class, Map.class, e);
- continue;
- }
-
- authModuleTypeOptions.setObject(reader, context, authModuleType, options);
- } else {
- context.unexpectedElement(elementReader, new QName(elementReader.getNamespaceURI(), elementReader.getLocalName()), new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "requestPolicy"), new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "responsePolicy"), new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "options"));
- }
- }
-
- context.afterUnmarshal(authModuleType, lifecycleCallback);
-
- return authModuleType;
- }
-
- public final void write(XoXMLStreamWriter writer, AuthModuleType authModuleType, RuntimeContext context)
- throws Exception
- {
- if (authModuleType == null) {
- writer.writeXsiNil();
- return ;
- }
-
- if (context == null) {
- context = new RuntimeContext();
- }
-
- String prefix = writer.getUniquePrefix("http://geronimo.apache.org/xml/ns/geronimo-jaspi");
- if (AuthModuleType.class!= authModuleType.getClass()) {
- context.unexpectedSubclass(writer, authModuleType, AuthModuleType.class);
- return ;
- }
-
- context.beforeMarshal(authModuleType, lifecycleCallback);
-
-
- // ELEMENT: className
- String className = authModuleTypeClassName.getObject(authModuleType, context, authModuleType);
- if (className!= null) {
- writer.writeStartElement(prefix, "className", "http://geronimo.apache.org/xml/ns/geronimo-jaspi");
- writer.writeCharacters(className);
- writer.writeEndElement();
- } else {
- context.unexpectedNullValue(authModuleType, "className");
- }
-
- // ELEMENT: requestPolicy
- MessagePolicyType requestPolicy = authModuleTypeRequestPolicy.getObject(authModuleType, context, authModuleType);
- if (requestPolicy!= null) {
- writer.writeStartElement(prefix, "requestPolicy", "http://geronimo.apache.org/xml/ns/geronimo-jaspi");
- writeMessagePolicyType(writer, requestPolicy, context);
- writer.writeEndElement();
- } else {
- context.unexpectedNullValue(authModuleType, "requestPolicy");
- }
-
- // ELEMENT: responsePolicy
- MessagePolicyType responsePolicy = authModuleTypeResponsePolicy.getObject(authModuleType, context, authModuleType);
- if (responsePolicy!= null) {
- writer.writeStartElement(prefix, "responsePolicy", "http://geronimo.apache.org/xml/ns/geronimo-jaspi");
- writeMessagePolicyType(writer, responsePolicy, context);
- writer.writeEndElement();
- } else {
- context.unexpectedNullValue(authModuleType, "responsePolicy");
- }
-
- // ELEMENT: options
- Map<String, String> optionsRaw = authModuleTypeOptions.getObject(authModuleType, context, authModuleType);
- String options = null;
- try {
- options = stringMapAdapterAdapter.marshal(optionsRaw);
- } catch (Exception e) {
- context.xmlAdapterError(authModuleType, "options", StringMapAdapter.class, Map.class, Map.class, e);
- }
- if (options!= null) {
- writer.writeStartElement(prefix, "options", "http://geronimo.apache.org/xml/ns/geronimo-jaspi");
- writer.writeCharacters(options);
- writer.writeEndElement();
- }
-
- context.afterMarshal(authModuleType, lifecycleCallback);
- }
-
-}
diff --git a/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/ClientAuthConfigTypeJAXB.java b/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/ClientAuthConfigTypeJAXB.java
deleted file mode 100644
index 3efdff9..0000000
--- a/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/ClientAuthConfigTypeJAXB.java
+++ /dev/null
@@ -1,225 +0,0 @@
-/**
- * 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 sxc.org.apache.geronimo.components.jaspi.model;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.XMLConstants;
-import javax.xml.namespace.QName;
-import com.envoisolutions.sxc.jaxb.FieldAccessor;
-import com.envoisolutions.sxc.jaxb.JAXBObject;
-import com.envoisolutions.sxc.jaxb.LifecycleCallback;
-import com.envoisolutions.sxc.jaxb.RuntimeContext;
-import com.envoisolutions.sxc.util.Attribute;
-import com.envoisolutions.sxc.util.XoXMLStreamReader;
-import com.envoisolutions.sxc.util.XoXMLStreamWriter;
-import org.apache.geronimo.components.jaspi.model.ClientAuthConfigType;
-import org.apache.geronimo.components.jaspi.model.ClientAuthContextType;
-import org.apache.geronimo.components.jaspi.model.KeyedObjectMapAdapter;
-
-
-import static sxc.org.apache.geronimo.components.jaspi.model.ClientAuthContextTypeJAXB.readClientAuthContextType;
-import static sxc.org.apache.geronimo.components.jaspi.model.ClientAuthContextTypeJAXB.writeClientAuthContextType;
-
-/**
- * @version $Rev$ $Date$
- */
-
-@SuppressWarnings({
- "StringEquality"
-})
-public class ClientAuthConfigTypeJAXB
- extends JAXBObject<ClientAuthConfigType>
-{
-
- public final static ClientAuthConfigTypeJAXB INSTANCE = new ClientAuthConfigTypeJAXB();
- private final static LifecycleCallback lifecycleCallback = new LifecycleCallback(ClientAuthConfigType.class);
- private final static FieldAccessor<ClientAuthConfigType, String> clientAuthConfigTypeMessageLayer = new FieldAccessor<ClientAuthConfigType, String>(ClientAuthConfigType.class, "messageLayer");
- private final static FieldAccessor<ClientAuthConfigType, String> clientAuthConfigTypeAppContext = new FieldAccessor<ClientAuthConfigType, String>(ClientAuthConfigType.class, "appContext");
- private final static FieldAccessor<ClientAuthConfigType, String> clientAuthConfigTypeAuthenticationContextID = new FieldAccessor<ClientAuthConfigType, String>(ClientAuthConfigType.class, "authenticationContextID");
- private final static FieldAccessor<ClientAuthConfigType, Boolean> clientAuthConfigType_protected = new FieldAccessor<ClientAuthConfigType, Boolean>(ClientAuthConfigType.class, "_protected");
- private final static FieldAccessor<ClientAuthConfigType, Map<String, ClientAuthContextType>> clientAuthConfigTypeClientAuthContext = new FieldAccessor<ClientAuthConfigType, Map<String, ClientAuthContextType>>(ClientAuthConfigType.class, "clientAuthContext");
- private final static KeyedObjectMapAdapter<ClientAuthContextType> clientAuthContextMapAdapter = new KeyedObjectMapAdapter<ClientAuthContextType>(ClientAuthContextType.class);
-
- public ClientAuthConfigTypeJAXB() {
- super(ClientAuthConfigType.class, null, new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi".intern(), "clientAuthConfigType".intern()), ClientAuthContextTypeJAXB.class);
- }
-
- public static ClientAuthConfigType readClientAuthConfigType(XoXMLStreamReader reader, RuntimeContext context)
- throws Exception
- {
- return INSTANCE.read(reader, context);
- }
-
- public static void writeClientAuthConfigType(XoXMLStreamWriter writer, ClientAuthConfigType clientAuthConfigType, RuntimeContext context)
- throws Exception
- {
- INSTANCE.write(writer, clientAuthConfigType, context);
- }
-
- public final ClientAuthConfigType read(XoXMLStreamReader reader, RuntimeContext context)
- throws Exception
- {
-
- // Check for xsi:nil
- if (reader.isXsiNil()) {
- return null;
- }
-
- if (context == null) {
- context = new RuntimeContext();
- }
-
- ClientAuthConfigType clientAuthConfigType = new ClientAuthConfigType();
- context.beforeUnmarshal(clientAuthConfigType, lifecycleCallback);
-
- List<ClientAuthContextType> clientAuthContextRaw = new ArrayList<ClientAuthContextType>();
-
- // Check xsi:type
- QName xsiType = reader.getXsiType();
- if (xsiType!= null) {
- if (("clientAuthConfigType"!= xsiType.getLocalPart())||("http://geronimo.apache.org/xml/ns/geronimo-jaspi"!= xsiType.getNamespaceURI())) {
- return context.unexpectedXsiType(reader, ClientAuthConfigType.class);
- }
- }
-
- // Read attributes
- for (Attribute attribute: reader.getAttributes()) {
- if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) {
- context.unexpectedAttribute(attribute);
- }
- }
-
- // Read elements
- for (XoXMLStreamReader elementReader: reader.getChildElements()) {
- if (("messageLayer" == elementReader.getLocalName())&&("http://geronimo.apache.org/xml/ns/geronimo-jaspi" == elementReader.getNamespaceURI())) {
- // ELEMENT: messageLayer
- String messageLayer = elementReader.getElementAsString();
- clientAuthConfigTypeMessageLayer.setObject(reader, context, clientAuthConfigType, messageLayer);
- } else if (("appContext" == elementReader.getLocalName())&&("http://geronimo.apache.org/xml/ns/geronimo-jaspi" == elementReader.getNamespaceURI())) {
- // ELEMENT: appContext
- String appContext = elementReader.getElementAsString();
- clientAuthConfigTypeAppContext.setObject(reader, context, clientAuthConfigType, appContext);
- } else if (("authenticationContextID" == elementReader.getLocalName())&&("http://geronimo.apache.org/xml/ns/geronimo-jaspi" == elementReader.getNamespaceURI())) {
- // ELEMENT: authenticationContextID
- String authenticationContextID = elementReader.getElementAsString();
- clientAuthConfigTypeAuthenticationContextID.setObject(reader, context, clientAuthConfigType, authenticationContextID);
- } else if (("protected" == elementReader.getLocalName())&&("http://geronimo.apache.org/xml/ns/geronimo-jaspi" == elementReader.getNamespaceURI())) {
- // ELEMENT: _protected
- Boolean _protected = ("1".equals(elementReader.getElementAsString())||"true".equals(elementReader.getElementAsString()));
- clientAuthConfigType_protected.setBoolean(reader, context, clientAuthConfigType, _protected);
- } else if (("clientAuthContext" == elementReader.getLocalName())&&("http://geronimo.apache.org/xml/ns/geronimo-jaspi" == elementReader.getNamespaceURI())) {
- // ELEMENT: clientAuthContext
- ClientAuthContextType clientAuthContextItem = readClientAuthContextType(elementReader, context);
-// if (clientAuthContextRaw == null) {
-// clientAuthContextRaw = clientAuthConfigTypeClientAuthContext.getObject(reader, context, clientAuthConfigType);
-// if (clientAuthContextRaw!= null) {
-// clientAuthContextRaw.clear();
-// } else {
-// clientAuthContextRaw = new ArrayList<ClientAuthContextType>();
-// }
-// }
- clientAuthContextRaw.add(clientAuthContextItem);
- } else {
- context.unexpectedElement(elementReader, new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "messageLayer"), new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "appContext"), new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "authenticationContextID"), new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "protected"), new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "clientAuthContext"));
- }
- }
- if (clientAuthContextRaw != null) {
- Map<String, ClientAuthContextType> clientAuthContext = clientAuthContextMapAdapter.unmarshal(clientAuthContextRaw.toArray(new ClientAuthContextType[clientAuthContextRaw.size()]));
- clientAuthConfigTypeClientAuthContext.setObject(reader, context, clientAuthConfigType, clientAuthContext);
- }
-
- context.afterUnmarshal(clientAuthConfigType, lifecycleCallback);
-
- return clientAuthConfigType;
- }
-
- public final void write(XoXMLStreamWriter writer, ClientAuthConfigType clientAuthConfigType, RuntimeContext context)
- throws Exception
- {
- if (clientAuthConfigType == null) {
- writer.writeXsiNil();
- return ;
- }
-
- if (context == null) {
- context = new RuntimeContext();
- }
-
- String prefix = writer.getUniquePrefix("http://geronimo.apache.org/xml/ns/geronimo-jaspi");
- if (ClientAuthConfigType.class!= clientAuthConfigType.getClass()) {
- context.unexpectedSubclass(writer, clientAuthConfigType, ClientAuthConfigType.class);
- return ;
- }
-
- context.beforeMarshal(clientAuthConfigType, lifecycleCallback);
-
-
- // ELEMENT: messageLayer
- String messageLayer = clientAuthConfigTypeMessageLayer.getObject(clientAuthConfigType, context, clientAuthConfigType);
- if (messageLayer!= null) {
- writer.writeStartElement(prefix, "messageLayer", "http://geronimo.apache.org/xml/ns/geronimo-jaspi");
- writer.writeCharacters(messageLayer);
- writer.writeEndElement();
- }
-
- // ELEMENT: appContext
- String appContext = clientAuthConfigTypeAppContext.getObject(clientAuthConfigType, context, clientAuthConfigType);
- if (appContext!= null) {
- writer.writeStartElement(prefix, "appContext", "http://geronimo.apache.org/xml/ns/geronimo-jaspi");
- writer.writeCharacters(appContext);
- writer.writeEndElement();
- }
-
- // ELEMENT: authenticationContextID
- String authenticationContextID = clientAuthConfigTypeAuthenticationContextID.getObject(clientAuthConfigType, context, clientAuthConfigType);
- if (authenticationContextID!= null) {
- writer.writeStartElement(prefix, "authenticationContextID", "http://geronimo.apache.org/xml/ns/geronimo-jaspi");
- writer.writeCharacters(authenticationContextID);
- writer.writeEndElement();
- } else {
- context.unexpectedNullValue(clientAuthConfigType, "authenticationContextID");
- }
-
- // ELEMENT: _protected
- Boolean _protected = clientAuthConfigType_protected.getBoolean(clientAuthConfigType, context, clientAuthConfigType);
- writer.writeStartElement(prefix, "protected", "http://geronimo.apache.org/xml/ns/geronimo-jaspi");
- writer.writeCharacters(Boolean.toString(_protected));
- writer.writeEndElement();
-
- // ELEMENT: clientAuthContext
- Map<String, ClientAuthContextType> clientAuthContextMap = clientAuthConfigTypeClientAuthContext.getObject(clientAuthConfigType, context, clientAuthConfigType);
- ClientAuthContextType[] clientAuthContext = clientAuthContextMapAdapter.marshal(clientAuthContextMap);
- if (clientAuthContext!= null) {
- for (ClientAuthContextType clientAuthContextItem: clientAuthContext) {
- writer.writeStartElement(prefix, "clientAuthContext", "http://geronimo.apache.org/xml/ns/geronimo-jaspi");
- if (clientAuthContextItem!= null) {
- writeClientAuthContextType(writer, clientAuthContextItem, context);
- } else {
- writer.writeXsiNil();
- }
- writer.writeEndElement();
- }
- }
-
- context.afterMarshal(clientAuthConfigType, lifecycleCallback);
- }
-
-}
diff --git a/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/ClientAuthContextTypeJAXB.java b/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/ClientAuthContextTypeJAXB.java
deleted file mode 100644
index 291a36b..0000000
--- a/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/ClientAuthContextTypeJAXB.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/**
- * 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 sxc.org.apache.geronimo.components.jaspi.model;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.xml.XMLConstants;
-import javax.xml.namespace.QName;
-import com.envoisolutions.sxc.jaxb.FieldAccessor;
-import com.envoisolutions.sxc.jaxb.JAXBObject;
-import com.envoisolutions.sxc.jaxb.LifecycleCallback;
-import com.envoisolutions.sxc.jaxb.RuntimeContext;
-import com.envoisolutions.sxc.util.Attribute;
-import com.envoisolutions.sxc.util.XoXMLStreamReader;
-import com.envoisolutions.sxc.util.XoXMLStreamWriter;
-import org.apache.geronimo.components.jaspi.model.AuthModuleType;
-import org.apache.geronimo.components.jaspi.model.ClientAuthContextType;
-
-
-import static sxc.org.apache.geronimo.components.jaspi.model.AuthModuleTypeJAXB.readClientAuthModuleType;
-import static sxc.org.apache.geronimo.components.jaspi.model.AuthModuleTypeJAXB.writeClientAuthModuleType;
-
-/**
- * @version $Rev$ $Date$
- */
-
-@SuppressWarnings({
- "StringEquality"
-})
-public class ClientAuthContextTypeJAXB
- extends JAXBObject<ClientAuthContextType>
-{
-
- public final static ClientAuthContextTypeJAXB INSTANCE = new ClientAuthContextTypeJAXB();
- private final static LifecycleCallback lifecycleCallback = new LifecycleCallback(ClientAuthContextType.class);
- private final static FieldAccessor<ClientAuthContextType, String> clientAuthContextTypeMessageLayer = new FieldAccessor<ClientAuthContextType, String>(ClientAuthContextType.class, "messageLayer");
- private final static FieldAccessor<ClientAuthContextType, String> clientAuthContextTypeAppContext = new FieldAccessor<ClientAuthContextType, String>(ClientAuthContextType.class, "appContext");
- private final static FieldAccessor<ClientAuthContextType, String> clientAuthContextTypeAuthenticationContextID = new FieldAccessor<ClientAuthContextType, String>(ClientAuthContextType.class, "authenticationContextID");
- private final static FieldAccessor<ClientAuthContextType, List<AuthModuleType>> clientAuthContextTypeClientAuthModule = new FieldAccessor<ClientAuthContextType, List<AuthModuleType>>(ClientAuthContextType.class, "clientAuthModule");
-
- public ClientAuthContextTypeJAXB() {
- super(ClientAuthContextType.class, null, new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi".intern(), "clientAuthContextType".intern()), AuthModuleTypeJAXB.class);
- }
-
- public static ClientAuthContextType readClientAuthContextType(XoXMLStreamReader reader, RuntimeContext context)
- throws Exception
- {
- return INSTANCE.read(reader, context);
- }
-
- public static void writeClientAuthContextType(XoXMLStreamWriter writer, ClientAuthContextType clientAuthContextType, RuntimeContext context)
- throws Exception
- {
- INSTANCE.write(writer, clientAuthContextType, context);
- }
-
- public final ClientAuthContextType read(XoXMLStreamReader reader, RuntimeContext context)
- throws Exception
- {
-
- // Check for xsi:nil
- if (reader.isXsiNil()) {
- return null;
- }
-
- if (context == null) {
- context = new RuntimeContext();
- }
-
- ClientAuthContextType clientAuthContextType = new ClientAuthContextType();
- context.beforeUnmarshal(clientAuthContextType, lifecycleCallback);
-
- List<AuthModuleType> clientAuthModule = null;
-
- // Check xsi:type
- QName xsiType = reader.getXsiType();
- if (xsiType!= null) {
- if (("clientAuthContextType"!= xsiType.getLocalPart())||("http://geronimo.apache.org/xml/ns/geronimo-jaspi"!= xsiType.getNamespaceURI())) {
- return context.unexpectedXsiType(reader, ClientAuthContextType.class);
- }
- }
-
- // Read attributes
- for (Attribute attribute: reader.getAttributes()) {
- if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) {
- context.unexpectedAttribute(attribute);
- }
- }
-
- // Read elements
- for (XoXMLStreamReader elementReader: reader.getChildElements()) {
- if (("messageLayer" == elementReader.getLocalName())&&("http://geronimo.apache.org/xml/ns/geronimo-jaspi" == elementReader.getNamespaceURI())) {
- // ELEMENT: messageLayer
- String messageLayer = elementReader.getElementAsString();
- clientAuthContextTypeMessageLayer.setObject(reader, context, clientAuthContextType, messageLayer);
- } else if (("appContext" == elementReader.getLocalName())&&("http://geronimo.apache.org/xml/ns/geronimo-jaspi" == elementReader.getNamespaceURI())) {
- // ELEMENT: appContext
- String appContext = elementReader.getElementAsString();
- clientAuthContextTypeAppContext.setObject(reader, context, clientAuthContextType, appContext);
- } else if (("authenticationContextID" == elementReader.getLocalName())&&("http://geronimo.apache.org/xml/ns/geronimo-jaspi" == elementReader.getNamespaceURI())) {
- // ELEMENT: authenticationContextID
- String authenticationContextID = elementReader.getElementAsString();
- clientAuthContextTypeAuthenticationContextID.setObject(reader, context, clientAuthContextType, authenticationContextID);
- } else if (("clientAuthModule" == elementReader.getLocalName())&&("http://geronimo.apache.org/xml/ns/geronimo-jaspi" == elementReader.getNamespaceURI())) {
- // ELEMENT: clientAuthModule
- AuthModuleType clientAuthModuleItem = readClientAuthModuleType(elementReader, context);
- if (clientAuthModule == null) {
- clientAuthModule = clientAuthContextTypeClientAuthModule.getObject(reader, context, clientAuthContextType);
- if (clientAuthModule!= null) {
- clientAuthModule.clear();
- } else {
- clientAuthModule = new ArrayList<AuthModuleType>();
- }
- }
- clientAuthModule.add(clientAuthModuleItem);
- } else {
- context.unexpectedElement(elementReader, new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "messageLayer"), new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "appContext"), new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "authenticationContextID"), new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "clientAuthModule"));
- }
- }
- if (clientAuthModule!= null) {
- clientAuthContextTypeClientAuthModule.setObject(reader, context, clientAuthContextType, clientAuthModule);
- }
-
- context.afterUnmarshal(clientAuthContextType, lifecycleCallback);
-
- return clientAuthContextType;
- }
-
- public final void write(XoXMLStreamWriter writer, ClientAuthContextType clientAuthContextType, RuntimeContext context)
- throws Exception
- {
- if (clientAuthContextType == null) {
- writer.writeXsiNil();
- return ;
- }
-
- if (context == null) {
- context = new RuntimeContext();
- }
-
- String prefix = writer.getUniquePrefix("http://geronimo.apache.org/xml/ns/geronimo-jaspi");
- if (ClientAuthContextType.class!= clientAuthContextType.getClass()) {
- context.unexpectedSubclass(writer, clientAuthContextType, ClientAuthContextType.class);
- return ;
- }
-
- context.beforeMarshal(clientAuthContextType, lifecycleCallback);
-
-
- // ELEMENT: messageLayer
- String messageLayer = clientAuthContextTypeMessageLayer.getObject(clientAuthContextType, context, clientAuthContextType);
- if (messageLayer!= null) {
- writer.writeStartElement(prefix, "messageLayer", "http://geronimo.apache.org/xml/ns/geronimo-jaspi");
- writer.writeCharacters(messageLayer);
- writer.writeEndElement();
- }
-
- // ELEMENT: appContext
- String appContext = clientAuthContextTypeAppContext.getObject(clientAuthContextType, context, clientAuthContextType);
- if (appContext!= null) {
- writer.writeStartElement(prefix, "appContext", "http://geronimo.apache.org/xml/ns/geronimo-jaspi");
- writer.writeCharacters(appContext);
- writer.writeEndElement();
- }
-
- // ELEMENT: authenticationContextID
- String authenticationContextID = clientAuthContextTypeAuthenticationContextID.getObject(clientAuthContextType, context, clientAuthContextType);
- if (authenticationContextID!= null) {
- writer.writeStartElement(prefix, "authenticationContextID", "http://geronimo.apache.org/xml/ns/geronimo-jaspi");
- writer.writeCharacters(authenticationContextID);
- writer.writeEndElement();
- } else {
- context.unexpectedNullValue(clientAuthContextType, "authenticationContextID");
- }
-
- // ELEMENT: clientAuthModule
- List<AuthModuleType> clientAuthModule = clientAuthContextTypeClientAuthModule.getObject(clientAuthContextType, context, clientAuthContextType);
- if (clientAuthModule!= null) {
- for (AuthModuleType clientAuthModuleItem: clientAuthModule) {
- writer.writeStartElement(prefix, "clientAuthModule", "http://geronimo.apache.org/xml/ns/geronimo-jaspi");
- if (clientAuthModuleItem!= null) {
- writeClientAuthModuleType(writer, clientAuthModuleItem, context);
- } else {
- writer.writeXsiNil();
- }
- writer.writeEndElement();
- }
- }
-
- context.afterMarshal(clientAuthContextType, lifecycleCallback);
- }
-
-}
diff --git a/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/ConfigProviderTypeJAXB.java b/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/ConfigProviderTypeJAXB.java
deleted file mode 100644
index 10b50d4..0000000
--- a/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/ConfigProviderTypeJAXB.java
+++ /dev/null
@@ -1,303 +0,0 @@
-/**
- * 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 sxc.org.apache.geronimo.components.jaspi.model;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import javax.xml.XMLConstants;
-import javax.xml.namespace.QName;
-import com.envoisolutions.sxc.jaxb.FieldAccessor;
-import com.envoisolutions.sxc.jaxb.JAXBObject;
-import com.envoisolutions.sxc.jaxb.LifecycleCallback;
-import com.envoisolutions.sxc.jaxb.RuntimeContext;
-import com.envoisolutions.sxc.util.Attribute;
-import com.envoisolutions.sxc.util.XoXMLStreamReader;
-import com.envoisolutions.sxc.util.XoXMLStreamWriter;
-import org.apache.geronimo.components.jaspi.model.ClientAuthConfigType;
-import org.apache.geronimo.components.jaspi.model.ConfigProviderType;
-import org.apache.geronimo.components.jaspi.model.ServerAuthConfigType;
-import org.apache.geronimo.components.jaspi.model.StringMapAdapter;
-import org.apache.geronimo.components.jaspi.model.KeyedObjectMapAdapter;
-
-
-import static sxc.org.apache.geronimo.components.jaspi.model.ClientAuthConfigTypeJAXB.readClientAuthConfigType;
-import static sxc.org.apache.geronimo.components.jaspi.model.ClientAuthConfigTypeJAXB.writeClientAuthConfigType;
-import static sxc.org.apache.geronimo.components.jaspi.model.ServerAuthConfigTypeJAXB.readServerAuthConfigType;
-import static sxc.org.apache.geronimo.components.jaspi.model.ServerAuthConfigTypeJAXB.writeServerAuthConfigType;
-
-/**
- * @version $Rev$ $Date$
- */
-
-@SuppressWarnings({
- "StringEquality"
-})
-public class ConfigProviderTypeJAXB
- extends JAXBObject<ConfigProviderType>
-{
-
- public final static ConfigProviderTypeJAXB INSTANCE = new ConfigProviderTypeJAXB();
- private final static LifecycleCallback lifecycleCallback = new LifecycleCallback(ConfigProviderType.class);
- private final static FieldAccessor<ConfigProviderType, String> configProviderTypeMessageLayer = new FieldAccessor<ConfigProviderType, String>(ConfigProviderType.class, "messageLayer");
- private final static FieldAccessor<ConfigProviderType, String> configProviderTypeAppContext = new FieldAccessor<ConfigProviderType, String>(ConfigProviderType.class, "appContext");
- private final static FieldAccessor<ConfigProviderType, String> configProviderTypeDescription = new FieldAccessor<ConfigProviderType, String>(ConfigProviderType.class, "description");
- private final static FieldAccessor<ConfigProviderType, String> configProviderTypeClassName = new FieldAccessor<ConfigProviderType, String>(ConfigProviderType.class, "className");
- private final static FieldAccessor<ConfigProviderType, Map<String, String>> configProviderTypeProperties = new FieldAccessor<ConfigProviderType, Map<String, String>>(ConfigProviderType.class, "properties");
- private final static FieldAccessor<ConfigProviderType, Map<String, ClientAuthConfigType>> configProviderTypeClientAuthConfig = new FieldAccessor<ConfigProviderType, Map<String, ClientAuthConfigType>>(ConfigProviderType.class, "clientAuthConfig");
- private final static FieldAccessor<ConfigProviderType, Map<String, ServerAuthConfigType>> configProviderTypeServerAuthConfig = new FieldAccessor<ConfigProviderType, Map<String, ServerAuthConfigType>>(ConfigProviderType.class, "serverAuthConfig");
- private final static FieldAccessor<ConfigProviderType, Boolean> configProviderTypePersistent = new FieldAccessor<ConfigProviderType, Boolean>(ConfigProviderType.class, "persistent");
- private final static FieldAccessor<ConfigProviderType, String> configProviderTypeClassLoaderName = new FieldAccessor<ConfigProviderType, String>(ConfigProviderType.class, "classLoaderName");
- private final static StringMapAdapter stringMapAdapterAdapter = new StringMapAdapter();
- private final static KeyedObjectMapAdapter<ClientAuthConfigType> clientAuthConfigMapAdapter = new KeyedObjectMapAdapter<ClientAuthConfigType>(ClientAuthConfigType.class);
- private final static KeyedObjectMapAdapter<ServerAuthConfigType> serverAuthConfigMapAdapter = new KeyedObjectMapAdapter<ServerAuthConfigType>(ServerAuthConfigType.class);
-
- public ConfigProviderTypeJAXB() {
- super(ConfigProviderType.class, null, new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi".intern(), "configProviderType".intern()), ClientAuthConfigTypeJAXB.class, ServerAuthConfigTypeJAXB.class);
- }
-
- public static ConfigProviderType readConfigProviderType(XoXMLStreamReader reader, RuntimeContext context)
- throws Exception
- {
- return INSTANCE.read(reader, context);
- }
-
- public static void writeConfigProviderType(XoXMLStreamWriter writer, ConfigProviderType configProviderType, RuntimeContext context)
- throws Exception
- {
- INSTANCE.write(writer, configProviderType, context);
- }
-
- public final ConfigProviderType read(XoXMLStreamReader reader, RuntimeContext context)
- throws Exception
- {
-
- // Check for xsi:nil
- if (reader.isXsiNil()) {
- return null;
- }
-
- if (context == null) {
- context = new RuntimeContext();
- }
-
- ConfigProviderType configProviderType = new ConfigProviderType();
- context.beforeUnmarshal(configProviderType, lifecycleCallback);
-
- List<ClientAuthConfigType> clientAuthConfigRaw = new ArrayList<ClientAuthConfigType>();
- List<ServerAuthConfigType> serverAuthConfigRaw = new ArrayList<ServerAuthConfigType>();
-
- // Check xsi:type
- QName xsiType = reader.getXsiType();
- if (xsiType!= null) {
- if (("configProviderType"!= xsiType.getLocalPart())||("http://geronimo.apache.org/xml/ns/geronimo-jaspi"!= xsiType.getNamespaceURI())) {
- return context.unexpectedXsiType(reader, ConfigProviderType.class);
- }
- }
-
- // Read attributes
- for (Attribute attribute: reader.getAttributes()) {
- if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) {
- context.unexpectedAttribute(attribute);
- }
- }
-
- // Read elements
- for (XoXMLStreamReader elementReader: reader.getChildElements()) {
- if (("messageLayer" == elementReader.getLocalName())&&("http://geronimo.apache.org/xml/ns/geronimo-jaspi" == elementReader.getNamespaceURI())) {
- // ELEMENT: messageLayer
- String messageLayer = elementReader.getElementAsString();
- configProviderTypeMessageLayer.setObject(reader, context, configProviderType, messageLayer);
- } else if (("appContext" == elementReader.getLocalName())&&("http://geronimo.apache.org/xml/ns/geronimo-jaspi" == elementReader.getNamespaceURI())) {
- // ELEMENT: appContext
- String appContext = elementReader.getElementAsString();
- configProviderTypeAppContext.setObject(reader, context, configProviderType, appContext);
- } else if (("description" == elementReader.getLocalName())&&("http://geronimo.apache.org/xml/ns/geronimo-jaspi" == elementReader.getNamespaceURI())) {
- // ELEMENT: description
- String description = elementReader.getElementAsString();
- configProviderTypeDescription.setObject(reader, context, configProviderType, description);
- } else if (("className" == elementReader.getLocalName())&&("http://geronimo.apache.org/xml/ns/geronimo-jaspi" == elementReader.getNamespaceURI())) {
- // ELEMENT: className
- String className = elementReader.getElementAsString();
- configProviderTypeClassName.setObject(reader, context, configProviderType, className);
- } else if (("properties" == elementReader.getLocalName())&&("http://geronimo.apache.org/xml/ns/geronimo-jaspi" == elementReader.getNamespaceURI())) {
- // ELEMENT: properties
- String propertiesRaw = elementReader.getElementAsString();
-
- Map properties;
- try {
- properties = stringMapAdapterAdapter.unmarshal(propertiesRaw);
- } catch (Exception e) {
- context.xmlAdapterError(elementReader, StringMapAdapter.class, Map.class, Map.class, e);
- continue;
- }
-
- configProviderTypeProperties.setObject(reader, context, configProviderType, properties);
- } else if (("clientAuthConfig" == elementReader.getLocalName())&&("http://geronimo.apache.org/xml/ns/geronimo-jaspi" == elementReader.getNamespaceURI())) {
- // ELEMENT: clientAuthConfig
- ClientAuthConfigType clientAuthConfigItem = readClientAuthConfigType(elementReader, context);
- clientAuthConfigRaw.add(clientAuthConfigItem);
- } else if (("serverAuthConfig" == elementReader.getLocalName())&&("http://geronimo.apache.org/xml/ns/geronimo-jaspi" == elementReader.getNamespaceURI())) {
- // ELEMENT: serverAuthConfig
- ServerAuthConfigType serverAuthConfigItem = readServerAuthConfigType(elementReader, context);
- serverAuthConfigRaw.add(serverAuthConfigItem);
- } else if (("persistent" == elementReader.getLocalName())&&("http://geronimo.apache.org/xml/ns/geronimo-jaspi" == elementReader.getNamespaceURI())) {
- // ELEMENT: persistent
- Boolean persistent = ("1".equals(elementReader.getElementAsString())||"true".equals(elementReader.getElementAsString()));
- configProviderTypePersistent.setObject(reader, context, configProviderType, persistent);
- } else if (("classLoaderName" == elementReader.getLocalName())&&("http://geronimo.apache.org/xml/ns/geronimo-jaspi" == elementReader.getNamespaceURI())) {
- // ELEMENT: classLoaderName
- String classLoaderName = elementReader.getElementAsString();
- configProviderTypeClassLoaderName.setObject(reader, context, configProviderType, classLoaderName);
- } else {
- context.unexpectedElement(elementReader, new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "messageLayer"), new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "appContext"), new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "description"), new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "className"), new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "properties"), new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "clientAuthConfig"), new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "serverAuthConfig"), new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "persistent"), new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "classLoaderName"));
- }
- }
- if (clientAuthConfigRaw!= null) {
- Map<String, ClientAuthConfigType> clientAuthConfig = clientAuthConfigMapAdapter.unmarshal(clientAuthConfigRaw.toArray(new ClientAuthConfigType[clientAuthConfigRaw.size()]));
- configProviderTypeClientAuthConfig.setObject(reader, context, configProviderType, clientAuthConfig);
- }
- if (serverAuthConfigRaw!= null) {
- Map<String, ServerAuthConfigType> serverAuthConfig = serverAuthConfigMapAdapter.unmarshal(serverAuthConfigRaw.toArray(new ServerAuthConfigType[serverAuthConfigRaw.size()]));
- configProviderTypeServerAuthConfig.setObject(reader, context, configProviderType, serverAuthConfig);
- }
-
- context.afterUnmarshal(configProviderType, lifecycleCallback);
-
- return configProviderType;
- }
-
- public final void write(XoXMLStreamWriter writer, ConfigProviderType configProviderType, RuntimeContext context)
- throws Exception
- {
- if (configProviderType == null) {
- writer.writeXsiNil();
- return ;
- }
-
- if (context == null) {
- context = new RuntimeContext();
- }
-
- String prefix = writer.getUniquePrefix("http://geronimo.apache.org/xml/ns/geronimo-jaspi");
- if (ConfigProviderType.class!= configProviderType.getClass()) {
- context.unexpectedSubclass(writer, configProviderType, ConfigProviderType.class);
- return ;
- }
-
- context.beforeMarshal(configProviderType, lifecycleCallback);
-
-
- // ELEMENT: messageLayer
- String messageLayer = configProviderTypeMessageLayer.getObject(configProviderType, context, configProviderType);
- if (messageLayer!= null) {
- writer.writeStartElement(prefix, "messageLayer", "http://geronimo.apache.org/xml/ns/geronimo-jaspi");
- writer.writeCharacters(messageLayer);
- writer.writeEndElement();
- }
-
- // ELEMENT: appContext
- String appContext = configProviderTypeAppContext.getObject(configProviderType, context, configProviderType);
- if (appContext!= null) {
- writer.writeStartElement(prefix, "appContext", "http://geronimo.apache.org/xml/ns/geronimo-jaspi");
- writer.writeCharacters(appContext);
- writer.writeEndElement();
- }
-
- // ELEMENT: description
- String description = configProviderTypeDescription.getObject(configProviderType, context, configProviderType);
- if (description!= null) {
- writer.writeStartElement(prefix, "description", "http://geronimo.apache.org/xml/ns/geronimo-jaspi");
- writer.writeCharacters(description);
- writer.writeEndElement();
- }
-
- // ELEMENT: className
- String className = configProviderTypeClassName.getObject(configProviderType, context, configProviderType);
- if (className!= null) {
- writer.writeStartElement(prefix, "className", "http://geronimo.apache.org/xml/ns/geronimo-jaspi");
- writer.writeCharacters(className);
- writer.writeEndElement();
- }
-
- // ELEMENT: properties
- Map<String, String> propertiesRaw = configProviderTypeProperties.getObject(configProviderType, context, configProviderType);
- String properties = null;
- try {
- properties = stringMapAdapterAdapter.marshal(propertiesRaw);
- } catch (Exception e) {
- context.xmlAdapterError(configProviderType, "properties", StringMapAdapter.class, Map.class, Map.class, e);
- }
- if (properties!= null) {
- writer.writeStartElement(prefix, "properties", "http://geronimo.apache.org/xml/ns/geronimo-jaspi");
- writer.writeCharacters(properties);
- writer.writeEndElement();
- } else {
- context.unexpectedNullValue(configProviderType, "properties");
- }
-
- // ELEMENT: clientAuthConfig
- Map<String, ClientAuthConfigType> clientAuthConfigMap = configProviderTypeClientAuthConfig.getObject(configProviderType, context, configProviderType);
- ClientAuthConfigType[] clientAuthConfig = clientAuthConfigMapAdapter.marshal(clientAuthConfigMap);
- if (clientAuthConfig!= null) {
- for (ClientAuthConfigType clientAuthConfigItem: clientAuthConfig) {
- writer.writeStartElement(prefix, "clientAuthConfig", "http://geronimo.apache.org/xml/ns/geronimo-jaspi");
- if (clientAuthConfigItem!= null) {
- writeClientAuthConfigType(writer, clientAuthConfigItem, context);
- } else {
- writer.writeXsiNil();
- }
- writer.writeEndElement();
- }
- }
-
- // ELEMENT: serverAuthConfig
- Map<String,ServerAuthConfigType> serverAuthConfigMap = configProviderTypeServerAuthConfig.getObject(configProviderType, context, configProviderType);
- ServerAuthConfigType[] serverAuthConfig = serverAuthConfigMapAdapter.marshal(serverAuthConfigMap);
- if (serverAuthConfig!= null) {
- for (ServerAuthConfigType serverAuthConfigItem: serverAuthConfig) {
- writer.writeStartElement(prefix, "serverAuthConfig", "http://geronimo.apache.org/xml/ns/geronimo-jaspi");
- if (serverAuthConfigItem!= null) {
- writeServerAuthConfigType(writer, serverAuthConfigItem, context);
- } else {
- writer.writeXsiNil();
- }
- writer.writeEndElement();
- }
- }
-
- // ELEMENT: persistent
- Boolean persistent = configProviderTypePersistent.getObject(configProviderType, context, configProviderType);
- if (persistent!= null) {
- writer.writeStartElement(prefix, "persistent", "http://geronimo.apache.org/xml/ns/geronimo-jaspi");
- writer.writeCharacters(Boolean.toString(persistent));
- writer.writeEndElement();
- }
-
- // ELEMENT: classLoaderName
- String classLoaderName = configProviderTypeClassLoaderName.getObject(configProviderType, context, configProviderType);
- if (classLoaderName!= null) {
- writer.writeStartElement(prefix, "classLoaderName", "http://geronimo.apache.org/xml/ns/geronimo-jaspi");
- writer.writeCharacters(classLoaderName);
- writer.writeEndElement();
- }
-
- context.afterMarshal(configProviderType, lifecycleCallback);
- }
-
-}
diff --git a/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/JaspiTypeJAXB.java b/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/JaspiTypeJAXB.java
deleted file mode 100644
index 0f0c630..0000000
--- a/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/JaspiTypeJAXB.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/**
- * 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 sxc.org.apache.geronimo.components.jaspi.model;
-
-import java.util.Map;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.XMLConstants;
-import javax.xml.namespace.QName;
-import com.envoisolutions.sxc.jaxb.FieldAccessor;
-import com.envoisolutions.sxc.jaxb.JAXBObject;
-import com.envoisolutions.sxc.jaxb.LifecycleCallback;
-import com.envoisolutions.sxc.jaxb.RuntimeContext;
-import com.envoisolutions.sxc.util.Attribute;
-import com.envoisolutions.sxc.util.XoXMLStreamReader;
-import com.envoisolutions.sxc.util.XoXMLStreamWriter;
-import org.apache.geronimo.components.jaspi.model.KeyedObjectMapAdapter;
-import org.apache.geronimo.components.jaspi.model.ConfigProviderType;
-import org.apache.geronimo.components.jaspi.model.JaspiType;
-import static sxc.org.apache.geronimo.components.jaspi.model.ConfigProviderTypeJAXB.readConfigProviderType;
-import static sxc.org.apache.geronimo.components.jaspi.model.ConfigProviderTypeJAXB.writeConfigProviderType;
-
-/**
- * @version $Rev$ $Date$
- */
-
-@SuppressWarnings({
- "StringEquality"
-})
-public class JaspiTypeJAXB
- extends JAXBObject<JaspiType>
-{
-
- public final static JaspiTypeJAXB INSTANCE = new JaspiTypeJAXB();
- private final static LifecycleCallback lifecycleCallback = new LifecycleCallback(JaspiType.class);
- private final static FieldAccessor<JaspiType, Map<String, ConfigProviderType>> jaspiTypeConfigProvider = new FieldAccessor<JaspiType, Map<String, ConfigProviderType>>(JaspiType.class, "configProvider");
- private final static KeyedObjectMapAdapter<ConfigProviderType> configProviderMapAdapterAdapter = new KeyedObjectMapAdapter<ConfigProviderType>(ConfigProviderType.class);
-
- public JaspiTypeJAXB() {
- super(JaspiType.class, null, new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi".intern(), "jaspiType".intern()));
- }
-
- public static JaspiType readJaspiType(XoXMLStreamReader reader, RuntimeContext context)
- throws Exception
- {
- return INSTANCE.read(reader, context);
- }
-
- public static void writeJaspiType(XoXMLStreamWriter writer, JaspiType jaspiType, RuntimeContext context)
- throws Exception
- {
- INSTANCE.write(writer, jaspiType, context);
- }
-
- public final JaspiType read(XoXMLStreamReader reader, RuntimeContext context)
- throws Exception
- {
-
- // Check for xsi:nil
- if (reader.isXsiNil()) {
- return null;
- }
-
- if (context == null) {
- context = new RuntimeContext();
- }
-
- JaspiType jaspiType = new JaspiType();
- context.beforeUnmarshal(jaspiType, lifecycleCallback);
-
- List<ConfigProviderType> configProviderRaw = null;
-
- // Check xsi:type
- QName xsiType = reader.getXsiType();
- if (xsiType!= null) {
- if (("jaspiType"!= xsiType.getLocalPart())||("http://geronimo.apache.org/xml/ns/geronimo-jaspi"!= xsiType.getNamespaceURI())) {
- return context.unexpectedXsiType(reader, JaspiType.class);
- }
- }
-
- // Read attributes
- for (Attribute attribute: reader.getAttributes()) {
- if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) {
- context.unexpectedAttribute(attribute);
- }
- }
-
- // Read elements
- for (XoXMLStreamReader elementReader: reader.getChildElements()) {
- if (("configProvider" == elementReader.getLocalName())&&("http://geronimo.apache.org/xml/ns/geronimo-jaspi" == elementReader.getNamespaceURI())) {
- // ELEMENT: configProvider
- ConfigProviderType configProviderItem = readConfigProviderType(elementReader, context);
- if (configProviderRaw == null) {
- configProviderRaw = new ArrayList<ConfigProviderType>();
- }
- configProviderRaw.add(configProviderItem);
-
- } else {
- context.unexpectedElement(elementReader, new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "configProvider"));
- }
- }
-
- Map<String, ConfigProviderType> configProvider;
- try {
- ConfigProviderType[] configProviderArray = configProviderRaw == null? null: configProviderRaw.toArray(new ConfigProviderType[configProviderRaw.size()]);
- configProvider = configProviderMapAdapterAdapter.unmarshal(configProviderArray);
- jaspiTypeConfigProvider.setObject(reader, context, jaspiType, configProvider);
- } catch (Exception e) {
-// context.xmlAdapterError(null, KeyedObjectMapAdapter.class, Map.class, Map.class, e);
- throw e;
- }
-
-
- context.afterUnmarshal(jaspiType, lifecycleCallback);
-
- return jaspiType;
- }
-
- public final void write(XoXMLStreamWriter writer, JaspiType jaspiType, RuntimeContext context)
- throws Exception
- {
- if (jaspiType == null) {
- writer.writeXsiNil();
- return ;
- }
-
- if (context == null) {
- context = new RuntimeContext();
- }
-
- if (JaspiType.class!= jaspiType.getClass()) {
- context.unexpectedSubclass(writer, jaspiType, JaspiType.class);
- return ;
- }
-
- context.beforeMarshal(jaspiType, lifecycleCallback);
-
-
- // ELEMENT: configProvider
- Map<String, ConfigProviderType> configProviderRaw = jaspiTypeConfigProvider.getObject(jaspiType, context, jaspiType);
- ConfigProviderType[] configProvider = null;
- try {
- configProvider = configProviderMapAdapterAdapter.marshal(configProviderRaw);
- } catch (Exception e) {
- context.xmlAdapterError(jaspiType, "configProvider", KeyedObjectMapAdapter.class, Map.class, Map.class, e);
- }
- if (configProvider!= null) {
- for (ConfigProviderType configProviderItem: configProvider) {
- writer.writeStartElementWithAutoPrefix("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "configProvider");
- if (configProviderItem!= null) {
- writeConfigProviderType(writer, configProviderItem, context);
- } else {
- writer.writeXsiNil();
- }
- writer.writeEndElement();
- }
- }
-
- context.afterMarshal(jaspiType, lifecycleCallback);
- }
-
-}
diff --git a/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/MessagePolicyTypeJAXB.java b/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/MessagePolicyTypeJAXB.java
deleted file mode 100644
index 0a180bd..0000000
--- a/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/MessagePolicyTypeJAXB.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/**
- * 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 sxc.org.apache.geronimo.components.jaspi.model;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.xml.XMLConstants;
-import javax.xml.namespace.QName;
-import com.envoisolutions.sxc.jaxb.FieldAccessor;
-import com.envoisolutions.sxc.jaxb.JAXBObject;
-import com.envoisolutions.sxc.jaxb.LifecycleCallback;
-import com.envoisolutions.sxc.jaxb.RuntimeContext;
-import com.envoisolutions.sxc.util.Attribute;
-import com.envoisolutions.sxc.util.XoXMLStreamReader;
-import com.envoisolutions.sxc.util.XoXMLStreamWriter;
-import org.apache.geronimo.components.jaspi.model.MessagePolicyType;
-import org.apache.geronimo.components.jaspi.model.TargetPolicyType;
-
-
-import static sxc.org.apache.geronimo.components.jaspi.model.TargetPolicyTypeJAXB.readTargetPolicyType;
-import static sxc.org.apache.geronimo.components.jaspi.model.TargetPolicyTypeJAXB.writeTargetPolicyType;
-
-/**
- * @version $Rev$ $Date$
- */
-
-@SuppressWarnings({
- "StringEquality"
-})
-public class MessagePolicyTypeJAXB
- extends JAXBObject<MessagePolicyType>
-{
-
- public final static MessagePolicyTypeJAXB INSTANCE = new MessagePolicyTypeJAXB();
- private final static LifecycleCallback lifecycleCallback = new LifecycleCallback(MessagePolicyType.class);
- private final static FieldAccessor<MessagePolicyType, List<TargetPolicyType>> messagePolicyTypeTargetPolicy = new FieldAccessor<MessagePolicyType, List<TargetPolicyType>>(MessagePolicyType.class, "targetPolicy");
- private final static FieldAccessor<MessagePolicyType, Boolean> messagePolicyTypeMandatory = new FieldAccessor<MessagePolicyType, Boolean>(MessagePolicyType.class, "mandatory");
-
- public MessagePolicyTypeJAXB() {
- super(MessagePolicyType.class, null, new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi".intern(), "messagePolicyType".intern()), TargetPolicyTypeJAXB.class);
- }
-
- public static MessagePolicyType readMessagePolicyType(XoXMLStreamReader reader, RuntimeContext context)
- throws Exception
- {
- return INSTANCE.read(reader, context);
- }
-
- public static void writeMessagePolicyType(XoXMLStreamWriter writer, MessagePolicyType messagePolicyType, RuntimeContext context)
- throws Exception
- {
- INSTANCE.write(writer, messagePolicyType, context);
- }
-
- public final MessagePolicyType read(XoXMLStreamReader reader, RuntimeContext context)
- throws Exception
- {
-
- // Check for xsi:nil
- if (reader.isXsiNil()) {
- return null;
- }
-
- if (context == null) {
- context = new RuntimeContext();
- }
-
- MessagePolicyType messagePolicyType = new MessagePolicyType();
- context.beforeUnmarshal(messagePolicyType, lifecycleCallback);
-
- List<TargetPolicyType> targetPolicy = null;
-
- // Check xsi:type
- QName xsiType = reader.getXsiType();
- if (xsiType!= null) {
- if (("messagePolicyType"!= xsiType.getLocalPart())||("http://geronimo.apache.org/xml/ns/geronimo-jaspi"!= xsiType.getNamespaceURI())) {
- return context.unexpectedXsiType(reader, MessagePolicyType.class);
- }
- }
-
- // Read attributes
- for (Attribute attribute: reader.getAttributes()) {
- if (("mandatory" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) {
- // ATTRIBUTE: mandatory
- Boolean mandatory = ("1".equals(attribute.getValue())||"true".equals(attribute.getValue()));
- messagePolicyTypeMandatory.setObject(reader, context, messagePolicyType, mandatory);
- } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) {
- context.unexpectedAttribute(attribute, new QName("", "mandatory"));
- }
- }
-
- // Read elements
- for (XoXMLStreamReader elementReader: reader.getChildElements()) {
- if (("targetPolicy" == elementReader.getLocalName())&&("http://geronimo.apache.org/xml/ns/geronimo-jaspi" == elementReader.getNamespaceURI())) {
- // ELEMENT: targetPolicy
- TargetPolicyType targetPolicyItem = readTargetPolicyType(elementReader, context);
- if (targetPolicy == null) {
- targetPolicy = messagePolicyTypeTargetPolicy.getObject(reader, context, messagePolicyType);
- if (targetPolicy!= null) {
- targetPolicy.clear();
- } else {
- targetPolicy = new ArrayList<TargetPolicyType>();
- }
- }
- targetPolicy.add(targetPolicyItem);
- } else {
- context.unexpectedElement(elementReader, new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "targetPolicy"));
- }
- }
- if (targetPolicy!= null) {
- messagePolicyTypeTargetPolicy.setObject(reader, context, messagePolicyType, targetPolicy);
- }
-
- context.afterUnmarshal(messagePolicyType, lifecycleCallback);
-
- return messagePolicyType;
- }
-
- public final void write(XoXMLStreamWriter writer, MessagePolicyType messagePolicyType, RuntimeContext context)
- throws Exception
- {
- if (messagePolicyType == null) {
- writer.writeXsiNil();
- return ;
- }
-
- if (context == null) {
- context = new RuntimeContext();
- }
-
- if (MessagePolicyType.class!= messagePolicyType.getClass()) {
- context.unexpectedSubclass(writer, messagePolicyType, MessagePolicyType.class);
- return ;
- }
-
- context.beforeMarshal(messagePolicyType, lifecycleCallback);
-
-
- // ATTRIBUTE: mandatory
- Boolean mandatory = messagePolicyTypeMandatory.getObject(messagePolicyType, context, messagePolicyType);
- if (mandatory!= null) {
- writer.writeAttribute("", "", "mandatory", Boolean.toString(mandatory));
- }
-
- // ELEMENT: targetPolicy
- List<TargetPolicyType> targetPolicy = messagePolicyTypeTargetPolicy.getObject(messagePolicyType, context, messagePolicyType);
- if (targetPolicy!= null) {
- for (TargetPolicyType targetPolicyItem: targetPolicy) {
- writer.writeStartElementWithAutoPrefix("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "targetPolicy");
- if (targetPolicyItem!= null) {
- writeTargetPolicyType(writer, targetPolicyItem, context);
- } else {
- writer.writeXsiNil();
- }
- writer.writeEndElement();
- }
- }
-
- context.afterMarshal(messagePolicyType, lifecycleCallback);
- }
-
-}
diff --git a/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/ObjectFactoryJAXB.java b/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/ObjectFactoryJAXB.java
deleted file mode 100644
index cb5d68f..0000000
--- a/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/ObjectFactoryJAXB.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * 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 sxc.org.apache.geronimo.components.jaspi.model;
-
-import java.util.HashMap;
-import java.util.Map;
-import javax.xml.namespace.QName;
-import com.envoisolutions.sxc.jaxb.JAXBObject;
-import com.envoisolutions.sxc.jaxb.JAXBObjectFactory;
-import org.apache.geronimo.components.jaspi.model.ObjectFactory;
-
-/**
- * @version $Rev$ $Date$
- */
-
-public class ObjectFactoryJAXB
- extends JAXBObjectFactory<ObjectFactory>
-{
-
- public final static ObjectFactoryJAXB INSTANCE = new ObjectFactoryJAXB();
- private final Map<QName, Class<? extends JAXBObject>> rootElements = new HashMap<QName, Class<? extends JAXBObject>>();
-
- public ObjectFactoryJAXB() {
- super(ObjectFactory.class, JaspiTypeJAXB.class, ServerAuthContextTypeJAXB.class, AuthModuleTypeJAXB.class, ServerAuthConfigTypeJAXB.class, TargetTypeJAXB.class, MessagePolicyTypeJAXB.class, ClientAuthContextTypeJAXB.class, ConfigProviderTypeJAXB.class, TargetPolicyTypeJAXB.class, ClientAuthConfigTypeJAXB.class, ProtectionPolicyTypeJAXB.class);
- rootElements.put(new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi".intern(), "jaspi".intern()), JaspiTypeJAXB.class);
- }
-
- public Map<QName, Class<? extends JAXBObject>> getRootElements() {
- return rootElements;
- }
-
-}
diff --git a/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/ProtectionPolicyTypeJAXB.java b/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/ProtectionPolicyTypeJAXB.java
deleted file mode 100644
index 1a1ae3d..0000000
--- a/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/ProtectionPolicyTypeJAXB.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/**
- * 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 sxc.org.apache.geronimo.components.jaspi.model;
-
-import javax.xml.XMLConstants;
-import javax.xml.namespace.QName;
-import com.envoisolutions.sxc.jaxb.FieldAccessor;
-import com.envoisolutions.sxc.jaxb.JAXBObject;
-import com.envoisolutions.sxc.jaxb.LifecycleCallback;
-import com.envoisolutions.sxc.jaxb.RuntimeContext;
-import com.envoisolutions.sxc.util.Attribute;
-import com.envoisolutions.sxc.util.XoXMLStreamReader;
-import com.envoisolutions.sxc.util.XoXMLStreamWriter;
-import org.apache.geronimo.components.jaspi.model.ProtectionPolicyType;
-
-/**
- * @version $Rev$ $Date$
- */
-
-@SuppressWarnings({
- "StringEquality"
-})
-public class ProtectionPolicyTypeJAXB
- extends JAXBObject<ProtectionPolicyType>
-{
-
- public final static ProtectionPolicyTypeJAXB INSTANCE = new ProtectionPolicyTypeJAXB();
- private final static LifecycleCallback lifecycleCallback = new LifecycleCallback(ProtectionPolicyType.class);
- private final static FieldAccessor<ProtectionPolicyType, String> protectionPolicyTypeClassName = new FieldAccessor<ProtectionPolicyType, String>(ProtectionPolicyType.class, "className");
-
- public ProtectionPolicyTypeJAXB() {
- super(ProtectionPolicyType.class, null, new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi".intern(), "protectionPolicyType".intern()));
- }
-
- public static ProtectionPolicyType readProtectionPolicyType(XoXMLStreamReader reader, RuntimeContext context)
- throws Exception
- {
- return INSTANCE.read(reader, context);
- }
-
- public static void writeProtectionPolicyType(XoXMLStreamWriter writer, ProtectionPolicyType protectionPolicyType, RuntimeContext context)
- throws Exception
- {
- INSTANCE.write(writer, protectionPolicyType, context);
- }
-
- public final ProtectionPolicyType read(XoXMLStreamReader reader, RuntimeContext context)
- throws Exception
- {
-
- // Check for xsi:nil
- if (reader.isXsiNil()) {
- return null;
- }
-
- if (context == null) {
- context = new RuntimeContext();
- }
-
- ProtectionPolicyType protectionPolicyType = new ProtectionPolicyType();
- context.beforeUnmarshal(protectionPolicyType, lifecycleCallback);
-
-
- // Check xsi:type
- QName xsiType = reader.getXsiType();
- if (xsiType!= null) {
- if (("protectionPolicyType"!= xsiType.getLocalPart())||("http://geronimo.apache.org/xml/ns/geronimo-jaspi"!= xsiType.getNamespaceURI())) {
- return context.unexpectedXsiType(reader, ProtectionPolicyType.class);
- }
- }
-
- // Read attributes
- for (Attribute attribute: reader.getAttributes()) {
- if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) {
- context.unexpectedAttribute(attribute);
- }
- }
-
- // Read elements
- for (XoXMLStreamReader elementReader: reader.getChildElements()) {
- if (("className" == elementReader.getLocalName())&&("http://geronimo.apache.org/xml/ns/geronimo-jaspi" == elementReader.getNamespaceURI())) {
- // ELEMENT: className
- String className = elementReader.getElementAsString();
- protectionPolicyTypeClassName.setObject(reader, context, protectionPolicyType, className);
- } else {
- context.unexpectedElement(elementReader, new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "className"));
- }
- }
-
- context.afterUnmarshal(protectionPolicyType, lifecycleCallback);
-
- return protectionPolicyType;
- }
-
- public final void write(XoXMLStreamWriter writer, ProtectionPolicyType protectionPolicyType, RuntimeContext context)
- throws Exception
- {
- if (protectionPolicyType == null) {
- writer.writeXsiNil();
- return ;
- }
-
- if (context == null) {
- context = new RuntimeContext();
- }
-
- if (ProtectionPolicyType.class!= protectionPolicyType.getClass()) {
- context.unexpectedSubclass(writer, protectionPolicyType, ProtectionPolicyType.class);
- return ;
- }
-
- context.beforeMarshal(protectionPolicyType, lifecycleCallback);
-
-
- // ELEMENT: className
- String className = protectionPolicyTypeClassName.getObject(protectionPolicyType, context, protectionPolicyType);
- if (className!= null) {
- writer.writeStartElementWithAutoPrefix("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "className");
- writer.writeCharacters(className);
- writer.writeEndElement();
- } else {
- context.unexpectedNullValue(protectionPolicyType, "className");
- }
-
- context.afterMarshal(protectionPolicyType, lifecycleCallback);
- }
-
-}
diff --git a/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/ServerAuthConfigTypeJAXB.java b/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/ServerAuthConfigTypeJAXB.java
deleted file mode 100644
index ef5afd1..0000000
--- a/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/ServerAuthConfigTypeJAXB.java
+++ /dev/null
@@ -1,225 +0,0 @@
-/**
- * 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 sxc.org.apache.geronimo.components.jaspi.model;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.XMLConstants;
-import javax.xml.namespace.QName;
-import com.envoisolutions.sxc.jaxb.FieldAccessor;
-import com.envoisolutions.sxc.jaxb.JAXBObject;
-import com.envoisolutions.sxc.jaxb.LifecycleCallback;
-import com.envoisolutions.sxc.jaxb.RuntimeContext;
-import com.envoisolutions.sxc.util.Attribute;
-import com.envoisolutions.sxc.util.XoXMLStreamReader;
-import com.envoisolutions.sxc.util.XoXMLStreamWriter;
-import org.apache.geronimo.components.jaspi.model.ServerAuthConfigType;
-import org.apache.geronimo.components.jaspi.model.ServerAuthContextType;
-import org.apache.geronimo.components.jaspi.model.KeyedObjectMapAdapter;
-
-
-import static sxc.org.apache.geronimo.components.jaspi.model.ServerAuthContextTypeJAXB.readServerAuthContextType;
-import static sxc.org.apache.geronimo.components.jaspi.model.ServerAuthContextTypeJAXB.writeServerAuthContextType;
-
-/**
- * @version $Rev$ $Date$
- */
-
-@SuppressWarnings({
- "StringEquality"
-})
-public class ServerAuthConfigTypeJAXB
- extends JAXBObject<ServerAuthConfigType>
-{
-
- public final static ServerAuthConfigTypeJAXB INSTANCE = new ServerAuthConfigTypeJAXB();
- private final static LifecycleCallback lifecycleCallback = new LifecycleCallback(ServerAuthConfigType.class);
- private final static FieldAccessor<ServerAuthConfigType, String> serverAuthConfigTypeMessageLayer = new FieldAccessor<ServerAuthConfigType, String>(ServerAuthConfigType.class, "messageLayer");
- private final static FieldAccessor<ServerAuthConfigType, String> serverAuthConfigTypeAppContext = new FieldAccessor<ServerAuthConfigType, String>(ServerAuthConfigType.class, "appContext");
- private final static FieldAccessor<ServerAuthConfigType, String> serverAuthConfigTypeAuthenticationContextID = new FieldAccessor<ServerAuthConfigType, String>(ServerAuthConfigType.class, "authenticationContextID");
- private final static FieldAccessor<ServerAuthConfigType, Boolean> serverAuthConfigType_protected = new FieldAccessor<ServerAuthConfigType, Boolean>(ServerAuthConfigType.class, "_protected");
- private final static FieldAccessor<ServerAuthConfigType, Map<String, ServerAuthContextType>> serverAuthConfigTypeServerAuthContext = new FieldAccessor<ServerAuthConfigType, Map<String, ServerAuthContextType>>(ServerAuthConfigType.class, "serverAuthContext");
- private final static KeyedObjectMapAdapter<ServerAuthContextType> serverAuthContextMapAdapter = new KeyedObjectMapAdapter<ServerAuthContextType>(ServerAuthContextType.class);
-
- public ServerAuthConfigTypeJAXB() {
- super(ServerAuthConfigType.class, null, new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi".intern(), "serverAuthConfigType".intern()), ServerAuthContextTypeJAXB.class);
- }
-
- public static ServerAuthConfigType readServerAuthConfigType(XoXMLStreamReader reader, RuntimeContext context)
- throws Exception
- {
- return INSTANCE.read(reader, context);
- }
-
- public static void writeServerAuthConfigType(XoXMLStreamWriter writer, ServerAuthConfigType serverAuthConfigType, RuntimeContext context)
- throws Exception
- {
- INSTANCE.write(writer, serverAuthConfigType, context);
- }
-
- public final ServerAuthConfigType read(XoXMLStreamReader reader, RuntimeContext context)
- throws Exception
- {
-
- // Check for xsi:nil
- if (reader.isXsiNil()) {
- return null;
- }
-
- if (context == null) {
- context = new RuntimeContext();
- }
-
- ServerAuthConfigType serverAuthConfigType = new ServerAuthConfigType();
- context.beforeUnmarshal(serverAuthConfigType, lifecycleCallback);
-
- List<ServerAuthContextType> serverAuthContextRaw = new ArrayList<ServerAuthContextType>();
-
- // Check xsi:type
- QName xsiType = reader.getXsiType();
- if (xsiType!= null) {
- if (("serverAuthConfigType"!= xsiType.getLocalPart())||("http://geronimo.apache.org/xml/ns/geronimo-jaspi"!= xsiType.getNamespaceURI())) {
- return context.unexpectedXsiType(reader, ServerAuthConfigType.class);
- }
- }
-
- // Read attributes
- for (Attribute attribute: reader.getAttributes()) {
- if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) {
- context.unexpectedAttribute(attribute);
- }
- }
-
- // Read elements
- for (XoXMLStreamReader elementReader: reader.getChildElements()) {
- if (("messageLayer" == elementReader.getLocalName())&&("http://geronimo.apache.org/xml/ns/geronimo-jaspi" == elementReader.getNamespaceURI())) {
- // ELEMENT: messageLayer
- String messageLayer = elementReader.getElementAsString();
- serverAuthConfigTypeMessageLayer.setObject(reader, context, serverAuthConfigType, messageLayer);
- } else if (("appContext" == elementReader.getLocalName())&&("http://geronimo.apache.org/xml/ns/geronimo-jaspi" == elementReader.getNamespaceURI())) {
- // ELEMENT: appContext
- String appContext = elementReader.getElementAsString();
- serverAuthConfigTypeAppContext.setObject(reader, context, serverAuthConfigType, appContext);
- } else if (("authenticationContextID" == elementReader.getLocalName())&&("http://geronimo.apache.org/xml/ns/geronimo-jaspi" == elementReader.getNamespaceURI())) {
- // ELEMENT: authenticationContextID
- String authenticationContextID = elementReader.getElementAsString();
- serverAuthConfigTypeAuthenticationContextID.setObject(reader, context, serverAuthConfigType, authenticationContextID);
- } else if (("protected" == elementReader.getLocalName())&&("http://geronimo.apache.org/xml/ns/geronimo-jaspi" == elementReader.getNamespaceURI())) {
- // ELEMENT: _protected
- Boolean _protected = ("1".equals(elementReader.getElementAsString())||"true".equals(elementReader.getElementAsString()));
- serverAuthConfigType_protected.setBoolean(reader, context, serverAuthConfigType, _protected);
- } else if (("serverAuthContext" == elementReader.getLocalName())&&("http://geronimo.apache.org/xml/ns/geronimo-jaspi" == elementReader.getNamespaceURI())) {
- // ELEMENT: serverAuthContext
- ServerAuthContextType serverAuthContextItem = readServerAuthContextType(elementReader, context);
-// if (serverAuthContextRaw == null) {
-// serverAuthContextRaw = serverAuthConfigTypeServerAuthContext.getObject(reader, context, serverAuthConfigType);
-// if (serverAuthContextRaw != null) {
-// serverAuthContextRaw.clear();
-// } else {
-// serverAuthContextRaw = new ArrayList<ServerAuthContextType>();
-// }
-// }
- serverAuthContextRaw.add(serverAuthContextItem);
- } else {
- context.unexpectedElement(elementReader, new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "messageLayer"), new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "appContext"), new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "authenticationContextID"), new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "protected"), new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "serverAuthContext"));
- }
- }
- if (serverAuthContextRaw != null) {
- Map<String, ServerAuthContextType> serverAuthContext = serverAuthContextMapAdapter.unmarshal(serverAuthContextRaw.toArray(new ServerAuthContextType[serverAuthContextRaw.size()]));
- serverAuthConfigTypeServerAuthContext.setObject(reader, context, serverAuthConfigType, serverAuthContext);
- }
-
- context.afterUnmarshal(serverAuthConfigType, lifecycleCallback);
-
- return serverAuthConfigType;
- }
-
- public final void write(XoXMLStreamWriter writer, ServerAuthConfigType serverAuthConfigType, RuntimeContext context)
- throws Exception
- {
- if (serverAuthConfigType == null) {
- writer.writeXsiNil();
- return ;
- }
-
- if (context == null) {
- context = new RuntimeContext();
- }
-
- String prefix = writer.getUniquePrefix("http://geronimo.apache.org/xml/ns/geronimo-jaspi");
- if (ServerAuthConfigType.class!= serverAuthConfigType.getClass()) {
- context.unexpectedSubclass(writer, serverAuthConfigType, ServerAuthConfigType.class);
- return ;
- }
-
- context.beforeMarshal(serverAuthConfigType, lifecycleCallback);
-
-
- // ELEMENT: messageLayer
- String messageLayer = serverAuthConfigTypeMessageLayer.getObject(serverAuthConfigType, context, serverAuthConfigType);
- if (messageLayer!= null) {
- writer.writeStartElement(prefix, "messageLayer", "http://geronimo.apache.org/xml/ns/geronimo-jaspi");
- writer.writeCharacters(messageLayer);
- writer.writeEndElement();
- }
-
- // ELEMENT: appContext
- String appContext = serverAuthConfigTypeAppContext.getObject(serverAuthConfigType, context, serverAuthConfigType);
- if (appContext!= null) {
- writer.writeStartElement(prefix, "appContext", "http://geronimo.apache.org/xml/ns/geronimo-jaspi");
- writer.writeCharacters(appContext);
- writer.writeEndElement();
- }
-
- // ELEMENT: authenticationContextID
- String authenticationContextID = serverAuthConfigTypeAuthenticationContextID.getObject(serverAuthConfigType, context, serverAuthConfigType);
- if (authenticationContextID!= null) {
- writer.writeStartElement(prefix, "authenticationContextID", "http://geronimo.apache.org/xml/ns/geronimo-jaspi");
- writer.writeCharacters(authenticationContextID);
- writer.writeEndElement();
- } else {
- context.unexpectedNullValue(serverAuthConfigType, "authenticationContextID");
- }
-
- // ELEMENT: _protected
- Boolean _protected = serverAuthConfigType_protected.getBoolean(serverAuthConfigType, context, serverAuthConfigType);
- writer.writeStartElement(prefix, "protected", "http://geronimo.apache.org/xml/ns/geronimo-jaspi");
- writer.writeCharacters(Boolean.toString(_protected));
- writer.writeEndElement();
-
- // ELEMENT: serverAuthContext
- Map<String, ServerAuthContextType> serverAuthContextMap = serverAuthConfigTypeServerAuthContext.getObject(serverAuthConfigType, context, serverAuthConfigType);
- ServerAuthContextType[] serverAuthContext = serverAuthContextMapAdapter.marshal(serverAuthContextMap);
- if (serverAuthContext!= null) {
- for (ServerAuthContextType serverAuthContextItem: serverAuthContext) {
- writer.writeStartElement(prefix, "serverAuthContext", "http://geronimo.apache.org/xml/ns/geronimo-jaspi");
- if (serverAuthContextItem!= null) {
- writeServerAuthContextType(writer, serverAuthContextItem, context);
- } else {
- writer.writeXsiNil();
- }
- writer.writeEndElement();
- }
- }
-
- context.afterMarshal(serverAuthConfigType, lifecycleCallback);
- }
-
-}
diff --git a/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/ServerAuthContextTypeJAXB.java b/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/ServerAuthContextTypeJAXB.java
deleted file mode 100644
index c81f73f..0000000
--- a/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/ServerAuthContextTypeJAXB.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/**
- * 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 sxc.org.apache.geronimo.components.jaspi.model;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.XMLConstants;
-import javax.xml.namespace.QName;
-
-import com.envoisolutions.sxc.jaxb.FieldAccessor;
-import com.envoisolutions.sxc.jaxb.JAXBObject;
-import com.envoisolutions.sxc.jaxb.LifecycleCallback;
-import com.envoisolutions.sxc.jaxb.RuntimeContext;
-import com.envoisolutions.sxc.util.Attribute;
-import com.envoisolutions.sxc.util.XoXMLStreamReader;
-import com.envoisolutions.sxc.util.XoXMLStreamWriter;
-import org.apache.geronimo.components.jaspi.model.ServerAuthContextType;
-import org.apache.geronimo.components.jaspi.model.AuthModuleType;
-import static sxc.org.apache.geronimo.components.jaspi.model.AuthModuleTypeJAXB.readServerAuthModuleType;
-import static sxc.org.apache.geronimo.components.jaspi.model.AuthModuleTypeJAXB.writeServerAuthModuleType;
-
-/**
- * @version $Rev$ $Date$
- */
-
-@SuppressWarnings({
- "StringEquality"
-})
-public class ServerAuthContextTypeJAXB
- extends JAXBObject<ServerAuthContextType>
-{
-
- public final static ServerAuthContextTypeJAXB INSTANCE = new ServerAuthContextTypeJAXB();
- private final static LifecycleCallback lifecycleCallback = new LifecycleCallback(ServerAuthContextType.class);
- private final static FieldAccessor<ServerAuthContextType, String> serverAuthContextTypeMessageLayer = new FieldAccessor<ServerAuthContextType, String>(ServerAuthContextType.class, "messageLayer");
- private final static FieldAccessor<ServerAuthContextType, String> serverAuthContextTypeAppContext = new FieldAccessor<ServerAuthContextType, String>(ServerAuthContextType.class, "appContext");
- private final static FieldAccessor<ServerAuthContextType, String> serverAuthContextTypeAuthenticationContextID = new FieldAccessor<ServerAuthContextType, String>(ServerAuthContextType.class, "authenticationContextID");
- private final static FieldAccessor<ServerAuthContextType, List<AuthModuleType>> serverAuthContextTypeServerAuthModule = new FieldAccessor<ServerAuthContextType, List<AuthModuleType>>(ServerAuthContextType.class, "serverAuthModule");
-
- public ServerAuthContextTypeJAXB() {
- super(ServerAuthContextType.class, null, new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi".intern(), "serverAuthContextType".intern()), AuthModuleTypeJAXB.class);
- }
-
- public static ServerAuthContextType readServerAuthContextType(XoXMLStreamReader reader, RuntimeContext context)
- throws Exception
- {
- return INSTANCE.read(reader, context);
- }
-
- public static void writeServerAuthContextType(XoXMLStreamWriter writer, ServerAuthContextType serverAuthContextType, RuntimeContext context)
- throws Exception
- {
- INSTANCE.write(writer, serverAuthContextType, context);
- }
-
- public final ServerAuthContextType read(XoXMLStreamReader reader, RuntimeContext context)
- throws Exception
- {
-
- // Check for xsi:nil
- if (reader.isXsiNil()) {
- return null;
- }
-
- if (context == null) {
- context = new RuntimeContext();
- }
-
- ServerAuthContextType serverAuthContextType = new ServerAuthContextType();
- context.beforeUnmarshal(serverAuthContextType, lifecycleCallback);
-
- List<AuthModuleType> serverAuthModule = null;
-
- // Check xsi:type
- QName xsiType = reader.getXsiType();
- if (xsiType!= null) {
- if (("serverAuthContextType"!= xsiType.getLocalPart())||("http://geronimo.apache.org/xml/ns/geronimo-jaspi"!= xsiType.getNamespaceURI())) {
- return context.unexpectedXsiType(reader, ServerAuthContextType.class);
- }
- }
-
- // Read attributes
- for (Attribute attribute: reader.getAttributes()) {
- if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) {
- context.unexpectedAttribute(attribute);
- }
- }
-
- // Read elements
- for (XoXMLStreamReader elementReader: reader.getChildElements()) {
- if (("messageLayer" == elementReader.getLocalName())&&("http://geronimo.apache.org/xml/ns/geronimo-jaspi" == elementReader.getNamespaceURI())) {
- // ELEMENT: messageLayer
- String messageLayer = elementReader.getElementAsString();
- serverAuthContextTypeMessageLayer.setObject(reader, context, serverAuthContextType, messageLayer);
- } else if (("appContext" == elementReader.getLocalName())&&("http://geronimo.apache.org/xml/ns/geronimo-jaspi" == elementReader.getNamespaceURI())) {
- // ELEMENT: appContext
- String appContext = elementReader.getElementAsString();
- serverAuthContextTypeAppContext.setObject(reader, context, serverAuthContextType, appContext);
- } else if (("authenticationContextID" == elementReader.getLocalName())&&("http://geronimo.apache.org/xml/ns/geronimo-jaspi" == elementReader.getNamespaceURI())) {
- // ELEMENT: authenticationContextID
- String authenticationContextID = elementReader.getElementAsString();
- serverAuthContextTypeAuthenticationContextID.setObject(reader, context, serverAuthContextType, authenticationContextID);
- } else if (("serverAuthModule" == elementReader.getLocalName())&&("http://geronimo.apache.org/xml/ns/geronimo-jaspi" == elementReader.getNamespaceURI())) {
- // ELEMENT: serverAuthModule
- AuthModuleType serverAuthModuleItem = readServerAuthModuleType(elementReader, context);
- if (serverAuthModule == null) {
- serverAuthModule = serverAuthContextTypeServerAuthModule.getObject(reader, context, serverAuthContextType);
- if (serverAuthModule!= null) {
- serverAuthModule.clear();
- } else {
- serverAuthModule = new ArrayList<AuthModuleType>();
- }
- }
- serverAuthModule.add(serverAuthModuleItem);
- } else {
- context.unexpectedElement(elementReader, new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "messageLayer"), new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "appContext"), new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "authenticationContextID"), new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "serverAuthModule"));
- }
- }
- if (serverAuthModule!= null) {
- serverAuthContextTypeServerAuthModule.setObject(reader, context, serverAuthContextType, serverAuthModule);
- }
-
- context.afterUnmarshal(serverAuthContextType, lifecycleCallback);
-
- return serverAuthContextType;
- }
-
- public final void write(XoXMLStreamWriter writer, ServerAuthContextType serverAuthContextType, RuntimeContext context)
- throws Exception
- {
- if (serverAuthContextType == null) {
- writer.writeXsiNil();
- return ;
- }
-
- if (context == null) {
- context = new RuntimeContext();
- }
-
- String prefix = writer.getUniquePrefix("http://geronimo.apache.org/xml/ns/geronimo-jaspi");
- if (ServerAuthContextType.class!= serverAuthContextType.getClass()) {
- context.unexpectedSubclass(writer, serverAuthContextType, ServerAuthContextType.class);
- return ;
- }
-
- context.beforeMarshal(serverAuthContextType, lifecycleCallback);
-
-
- // ELEMENT: messageLayer
- String messageLayer = serverAuthContextTypeMessageLayer.getObject(serverAuthContextType, context, serverAuthContextType);
- if (messageLayer!= null) {
- writer.writeStartElement(prefix, "messageLayer", "http://geronimo.apache.org/xml/ns/geronimo-jaspi");
- writer.writeCharacters(messageLayer);
- writer.writeEndElement();
- }
-
- // ELEMENT: appContext
- String appContext = serverAuthContextTypeAppContext.getObject(serverAuthContextType, context, serverAuthContextType);
- if (appContext!= null) {
- writer.writeStartElement(prefix, "appContext", "http://geronimo.apache.org/xml/ns/geronimo-jaspi");
- writer.writeCharacters(appContext);
- writer.writeEndElement();
- }
-
- // ELEMENT: authenticationContextID
- String authenticationContextID = serverAuthContextTypeAuthenticationContextID.getObject(serverAuthContextType, context, serverAuthContextType);
- if (authenticationContextID!= null) {
- writer.writeStartElement(prefix, "authenticationContextID", "http://geronimo.apache.org/xml/ns/geronimo-jaspi");
- writer.writeCharacters(authenticationContextID);
- writer.writeEndElement();
- } else {
- context.unexpectedNullValue(serverAuthContextType, "authenticationContextID");
- }
-
- // ELEMENT: serverAuthModule
- List<AuthModuleType> serverAuthModule = serverAuthContextTypeServerAuthModule.getObject(serverAuthContextType, context, serverAuthContextType);
- if (serverAuthModule!= null) {
- for (AuthModuleType serverAuthModuleItem: serverAuthModule) {
- writer.writeStartElement(prefix, "serverAuthModule", "http://geronimo.apache.org/xml/ns/geronimo-jaspi");
- if (serverAuthModuleItem!= null) {
- writeServerAuthModuleType(writer, serverAuthModuleItem, context);
- } else {
- writer.writeXsiNil();
- }
- writer.writeEndElement();
- }
- }
-
- context.afterMarshal(serverAuthContextType, lifecycleCallback);
- }
-
-}
diff --git a/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/TargetPolicyTypeJAXB.java b/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/TargetPolicyTypeJAXB.java
deleted file mode 100644
index dd6957a..0000000
--- a/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/TargetPolicyTypeJAXB.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/**
- * 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 sxc.org.apache.geronimo.components.jaspi.model;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.xml.XMLConstants;
-import javax.xml.namespace.QName;
-import com.envoisolutions.sxc.jaxb.FieldAccessor;
-import com.envoisolutions.sxc.jaxb.JAXBObject;
-import com.envoisolutions.sxc.jaxb.LifecycleCallback;
-import com.envoisolutions.sxc.jaxb.RuntimeContext;
-import com.envoisolutions.sxc.util.Attribute;
-import com.envoisolutions.sxc.util.XoXMLStreamReader;
-import com.envoisolutions.sxc.util.XoXMLStreamWriter;
-import org.apache.geronimo.components.jaspi.model.ProtectionPolicyType;
-import org.apache.geronimo.components.jaspi.model.TargetPolicyType;
-import org.apache.geronimo.components.jaspi.model.TargetType;
-
-
-import static sxc.org.apache.geronimo.components.jaspi.model.ProtectionPolicyTypeJAXB.readProtectionPolicyType;
-import static sxc.org.apache.geronimo.components.jaspi.model.ProtectionPolicyTypeJAXB.writeProtectionPolicyType;
-import static sxc.org.apache.geronimo.components.jaspi.model.TargetTypeJAXB.readTargetType;
-import static sxc.org.apache.geronimo.components.jaspi.model.TargetTypeJAXB.writeTargetType;
-
-/**
- * @version $Rev$ $Date$
- */
-
-@SuppressWarnings({
- "StringEquality"
-})
-public class TargetPolicyTypeJAXB
- extends JAXBObject<TargetPolicyType>
-{
-
- public final static TargetPolicyTypeJAXB INSTANCE = new TargetPolicyTypeJAXB();
- private final static LifecycleCallback lifecycleCallback = new LifecycleCallback(TargetPolicyType.class);
- private final static FieldAccessor<TargetPolicyType, ProtectionPolicyType> targetPolicyTypeProtectionPolicy = new FieldAccessor<TargetPolicyType, ProtectionPolicyType>(TargetPolicyType.class, "protectionPolicy");
- private final static FieldAccessor<TargetPolicyType, List<TargetType>> targetPolicyTypeTarget = new FieldAccessor<TargetPolicyType, List<TargetType>>(TargetPolicyType.class, "target");
-
- public TargetPolicyTypeJAXB() {
- super(TargetPolicyType.class, null, new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi".intern(), "targetPolicyType".intern()), ProtectionPolicyTypeJAXB.class, TargetTypeJAXB.class);
- }
-
- public static TargetPolicyType readTargetPolicyType(XoXMLStreamReader reader, RuntimeContext context)
- throws Exception
- {
- return INSTANCE.read(reader, context);
- }
-
- public static void writeTargetPolicyType(XoXMLStreamWriter writer, TargetPolicyType targetPolicyType, RuntimeContext context)
- throws Exception
- {
- INSTANCE.write(writer, targetPolicyType, context);
- }
-
- public final TargetPolicyType read(XoXMLStreamReader reader, RuntimeContext context)
- throws Exception
- {
-
- // Check for xsi:nil
- if (reader.isXsiNil()) {
- return null;
- }
-
- if (context == null) {
- context = new RuntimeContext();
- }
-
- TargetPolicyType targetPolicyType = new TargetPolicyType();
- context.beforeUnmarshal(targetPolicyType, lifecycleCallback);
-
- List<TargetType> target = null;
-
- // Check xsi:type
- QName xsiType = reader.getXsiType();
- if (xsiType!= null) {
- if (("targetPolicyType"!= xsiType.getLocalPart())||("http://geronimo.apache.org/xml/ns/geronimo-jaspi"!= xsiType.getNamespaceURI())) {
- return context.unexpectedXsiType(reader, TargetPolicyType.class);
- }
- }
-
- // Read attributes
- for (Attribute attribute: reader.getAttributes()) {
- if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) {
- context.unexpectedAttribute(attribute);
- }
- }
-
- // Read elements
- for (XoXMLStreamReader elementReader: reader.getChildElements()) {
- if (("protectionPolicy" == elementReader.getLocalName())&&("http://geronimo.apache.org/xml/ns/geronimo-jaspi" == elementReader.getNamespaceURI())) {
- // ELEMENT: protectionPolicy
- ProtectionPolicyType protectionPolicy = readProtectionPolicyType(elementReader, context);
- targetPolicyTypeProtectionPolicy.setObject(reader, context, targetPolicyType, protectionPolicy);
- } else if (("target" == elementReader.getLocalName())&&("http://geronimo.apache.org/xml/ns/geronimo-jaspi" == elementReader.getNamespaceURI())) {
- // ELEMENT: target
- TargetType targetItem = readTargetType(elementReader, context);
- if (target == null) {
- target = targetPolicyTypeTarget.getObject(reader, context, targetPolicyType);
- if (target!= null) {
- target.clear();
- } else {
- target = new ArrayList<TargetType>();
- }
- }
- target.add(targetItem);
- } else {
- context.unexpectedElement(elementReader, new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "protectionPolicy"), new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "target"));
- }
- }
- if (target!= null) {
- targetPolicyTypeTarget.setObject(reader, context, targetPolicyType, target);
- }
-
- context.afterUnmarshal(targetPolicyType, lifecycleCallback);
-
- return targetPolicyType;
- }
-
- public final void write(XoXMLStreamWriter writer, TargetPolicyType targetPolicyType, RuntimeContext context)
- throws Exception
- {
- if (targetPolicyType == null) {
- writer.writeXsiNil();
- return ;
- }
-
- if (context == null) {
- context = new RuntimeContext();
- }
-
- String prefix = writer.getUniquePrefix("http://geronimo.apache.org/xml/ns/geronimo-jaspi");
- if (TargetPolicyType.class!= targetPolicyType.getClass()) {
- context.unexpectedSubclass(writer, targetPolicyType, TargetPolicyType.class);
- return ;
- }
-
- context.beforeMarshal(targetPolicyType, lifecycleCallback);
-
-
- // ELEMENT: protectionPolicy
- ProtectionPolicyType protectionPolicy = targetPolicyTypeProtectionPolicy.getObject(targetPolicyType, context, targetPolicyType);
- if (protectionPolicy!= null) {
- writer.writeStartElement(prefix, "protectionPolicy", "http://geronimo.apache.org/xml/ns/geronimo-jaspi");
- writeProtectionPolicyType(writer, protectionPolicy, context);
- writer.writeEndElement();
- } else {
- context.unexpectedNullValue(targetPolicyType, "protectionPolicy");
- }
-
- // ELEMENT: target
- List<TargetType> target = targetPolicyTypeTarget.getObject(targetPolicyType, context, targetPolicyType);
- if (target!= null) {
- for (TargetType targetItem: target) {
- writer.writeStartElement(prefix, "target", "http://geronimo.apache.org/xml/ns/geronimo-jaspi");
- if (targetItem!= null) {
- writeTargetType(writer, targetItem, context);
- } else {
- writer.writeXsiNil();
- }
- writer.writeEndElement();
- }
- }
-
- context.afterMarshal(targetPolicyType, lifecycleCallback);
- }
-
-}
diff --git a/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/TargetTypeJAXB.java b/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/TargetTypeJAXB.java
deleted file mode 100644
index 430494a..0000000
--- a/geronimo-jaspi/src/main/java/sxc/org/apache/geronimo/components/jaspi/model/TargetTypeJAXB.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/**
- * 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 sxc.org.apache.geronimo.components.jaspi.model;
-
-import javax.xml.XMLConstants;
-import javax.xml.namespace.QName;
-import com.envoisolutions.sxc.jaxb.FieldAccessor;
-import com.envoisolutions.sxc.jaxb.JAXBObject;
-import com.envoisolutions.sxc.jaxb.LifecycleCallback;
-import com.envoisolutions.sxc.jaxb.RuntimeContext;
-import com.envoisolutions.sxc.util.Attribute;
-import com.envoisolutions.sxc.util.XoXMLStreamReader;
-import com.envoisolutions.sxc.util.XoXMLStreamWriter;
-import org.apache.geronimo.components.jaspi.model.TargetType;
-
-/**
- * @version $Rev$ $Date$
- */
-
-@SuppressWarnings({
- "StringEquality"
-})
-public class TargetTypeJAXB
- extends JAXBObject<TargetType>
-{
-
- public final static TargetTypeJAXB INSTANCE = new TargetTypeJAXB();
- private final static LifecycleCallback lifecycleCallback = new LifecycleCallback(TargetType.class);
- private final static FieldAccessor<TargetType, String> targetTypeClassName = new FieldAccessor<TargetType, String>(TargetType.class, "className");
-
- public TargetTypeJAXB() {
- super(TargetType.class, null, new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi".intern(), "targetType".intern()));
- }
-
- public static TargetType readTargetType(XoXMLStreamReader reader, RuntimeContext context)
- throws Exception
- {
- return INSTANCE.read(reader, context);
- }
-
- public static void writeTargetType(XoXMLStreamWriter writer, TargetType targetType, RuntimeContext context)
- throws Exception
- {
- INSTANCE.write(writer, targetType, context);
- }
-
- public final TargetType read(XoXMLStreamReader reader, RuntimeContext context)
- throws Exception
- {
-
- // Check for xsi:nil
- if (reader.isXsiNil()) {
- return null;
- }
-
- if (context == null) {
- context = new RuntimeContext();
- }
-
- TargetType targetType = new TargetType();
- context.beforeUnmarshal(targetType, lifecycleCallback);
-
-
- // Check xsi:type
- QName xsiType = reader.getXsiType();
- if (xsiType!= null) {
- if (("targetType"!= xsiType.getLocalPart())||("http://geronimo.apache.org/xml/ns/geronimo-jaspi"!= xsiType.getNamespaceURI())) {
- return context.unexpectedXsiType(reader, TargetType.class);
- }
- }
-
- // Read attributes
- for (Attribute attribute: reader.getAttributes()) {
- if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) {
- context.unexpectedAttribute(attribute);
- }
- }
-
- // Read elements
- for (XoXMLStreamReader elementReader: reader.getChildElements()) {
- if (("className" == elementReader.getLocalName())&&("http://geronimo.apache.org/xml/ns/geronimo-jaspi" == elementReader.getNamespaceURI())) {
- // ELEMENT: className
- String className = elementReader.getElementAsString();
- targetTypeClassName.setObject(reader, context, targetType, className);
- } else {
- context.unexpectedElement(elementReader, new QName("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "className"));
- }
- }
-
- context.afterUnmarshal(targetType, lifecycleCallback);
-
- return targetType;
- }
-
- public final void write(XoXMLStreamWriter writer, TargetType targetType, RuntimeContext context)
- throws Exception
- {
- if (targetType == null) {
- writer.writeXsiNil();
- return ;
- }
-
- if (context == null) {
- context = new RuntimeContext();
- }
-
- if (TargetType.class!= targetType.getClass()) {
- context.unexpectedSubclass(writer, targetType, TargetType.class);
- return ;
- }
-
- context.beforeMarshal(targetType, lifecycleCallback);
-
-
- // ELEMENT: className
- String className = targetTypeClassName.getObject(targetType, context, targetType);
- if (className!= null) {
- writer.writeStartElementWithAutoPrefix("http://geronimo.apache.org/xml/ns/geronimo-jaspi", "className");
- writer.writeCharacters(className);
- writer.writeEndElement();
- } else {
- context.unexpectedNullValue(targetType, "className");
- }
-
- context.afterMarshal(targetType, lifecycleCallback);
- }
-
-}
diff --git a/geronimo-jaspi/src/main/resources/META-INF/sun-jaxb.episode b/geronimo-jaspi/src/main/resources/META-INF/sun-jaxb.episode
index b0649d1..cee9d72 100644
--- a/geronimo-jaspi/src/main/resources/META-INF/sun-jaxb.episode
+++ b/geronimo-jaspi/src/main/resources/META-INF/sun-jaxb.episode
@@ -1,36 +1,47 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<!--
- 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.
--->
<bindings version="2.1" xmlns="http://java.sun.com/xml/ns/jaxb">
<!--
-This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.1.5-b01-fcs
-See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
-Any modifications to this file will be lost upon recompilation of the source schema.
-Generated on: 2008.07.12 at 02:26:00 PM PDT
+This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833
+See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+Any modifications to this file will be lost upon recompilation of the source schema.
+Generated on: 2011.05.01 at 12:30:10 AM PDT
-->
<bindings scd="x-schema::tns" xmlns:tns="http://geronimo.apache.org/xml/ns/geronimo-jaspi">
<schemaBindings map="false"/>
- <bindings scd="~tns:configProviderType">
- <class ref="org.apache.geronimo.components.jaspi.ConfigProviderType"/>
+ <bindings scd="~tns:serverAuthConfigType">
+ <class ref="org.apache.geronimo.components.jaspi.model.ServerAuthConfigType"/>
</bindings>
<bindings scd="~tns:jaspiType">
- <class ref="org.apache.geronimo.components.jaspi.JaspiType"/>
+ <class ref="org.apache.geronimo.components.jaspi.model.JaspiType"/>
+ </bindings>
+ <bindings scd="~tns:configProviderType">
+ <class ref="org.apache.geronimo.components.jaspi.model.ConfigProviderType"/>
+ </bindings>
+ <bindings scd="~tns:authModuleType">
+ <class ref="org.apache.geronimo.components.jaspi.model.AuthModuleType"/>
+ </bindings>
+ <bindings scd="~tns:targetPolicyType">
+ <class ref="org.apache.geronimo.components.jaspi.model.TargetPolicyType"/>
+ </bindings>
+ <bindings scd="~tns:clientAuthConfigType">
+ <class ref="org.apache.geronimo.components.jaspi.model.ClientAuthConfigType"/>
+ </bindings>
+ <bindings scd="~tns:messagePolicyType">
+ <class ref="org.apache.geronimo.components.jaspi.model.MessagePolicyType"/>
+ </bindings>
+ <bindings scd="~tns:clientAuthContextType">
+ <class ref="org.apache.geronimo.components.jaspi.model.ClientAuthContextType"/>
+ </bindings>
+ <bindings scd="~tns:protectionPolicyType">
+ <class ref="org.apache.geronimo.components.jaspi.model.ProtectionPolicyType"/>
+ </bindings>
+ <bindings scd="~tns:targetType">
+ <class ref="org.apache.geronimo.components.jaspi.model.TargetType"/>
+ </bindings>
+ <bindings scd="~tns:serverAuthContextType">
+ <class ref="org.apache.geronimo.components.jaspi.model.ServerAuthContextType"/>
</bindings>
</bindings>
</bindings>
diff --git a/geronimo-jaspi/src/main/xsd/geronimo-jaspi.xsd b/geronimo-jaspi/src/main/resources/geronimo-jaspi.xsd
similarity index 100%
rename from geronimo-jaspi/src/main/xsd/geronimo-jaspi.xsd
rename to geronimo-jaspi/src/main/resources/geronimo-jaspi.xsd
diff --git a/geronimo-jaspi/src/test/java/org/apache/geronimo/components/jaspi/model/JaxbTest.java b/geronimo-jaspi/src/test/java/org/apache/geronimo/components/jaspi/impl/JaxbTest.java
similarity index 78%
rename from geronimo-jaspi/src/test/java/org/apache/geronimo/components/jaspi/model/JaxbTest.java
rename to geronimo-jaspi/src/test/java/org/apache/geronimo/components/jaspi/impl/JaxbTest.java
index 5da55f3..ecae64f 100644
--- a/geronimo-jaspi/src/test/java/org/apache/geronimo/components/jaspi/model/JaxbTest.java
+++ b/geronimo-jaspi/src/test/java/org/apache/geronimo/components/jaspi/impl/JaxbTest.java
@@ -18,16 +18,13 @@
*/
-package org.apache.geronimo.components.jaspi.model;
+package org.apache.geronimo.components.jaspi.impl;
-import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
-import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.File;
-import java.io.UnsupportedEncodingException;
import java.io.Writer;
import java.io.FileWriter;
import java.io.FileReader;
@@ -46,11 +43,18 @@
import javax.security.auth.message.module.ClientAuthModule;
import javax.security.auth.callback.CallbackHandler;
+import org.apache.geronimo.components.jaspi.AuthConfigFactoryImpl;
+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.JaspiType;
+import org.apache.geronimo.components.jaspi.model.JaspiXmlUtil;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
/**
- * @version $Rev$ $Date$
+ * @version $Rev: 939768 $ $Date: 2010-04-30 11:26:46 -0700 (Fri, 30 Apr 2010) $
*/
public class JaxbTest {
@@ -66,7 +70,7 @@
JaspiType jaspi1 = loadJaspi(file);
if (jaspi1.getConfigProvider().size() != count) throw new Exception("expected " + count + " configprovider, not this: " + jaspi1.getConfigProvider());
File newFile = getWriteFile(file);
- Writer writer = getWriter(newFile);
+ Writer writer = new FileWriter(newFile);
JaspiXmlUtil.writeJaspi(jaspi1, writer);
JaspiType jaspi2 = JaspiXmlUtil.loadJaspi(new FileReader(newFile));
if (jaspi2.getConfigProvider().size() != count) throw new Exception("expected " + count + " configprovider, not this: " + jaspi2.getConfigProvider());
@@ -78,12 +82,15 @@
JaspiType jaspi1 = loadJaspi(file);
if (jaspi1.getConfigProvider().size() != count) throw new Exception("expected " + count + " configprovider, not this: " + jaspi1.getConfigProvider());
File newFile = getWriteFile(file);
- Writer writer = getWriter(newFile);
+ Writer writer = new FileWriter(newFile);
JaspiXmlUtil.writeJaspi(jaspi1, writer);
JaspiType jaspi2 = JaspiXmlUtil.loadJaspi(new FileReader(newFile));
if (jaspi2.getConfigProvider().size() != count) throw new Exception("expected " + count + " configprovider, not this: " + jaspi2.getConfigProvider());
- AuthConfigProvider configProvider = jaspi1.getConfigProvider().get(ConfigProviderType.getRegistrationKey("Http", "test-app1")).getProvider();
+ AuthConfigFactoryImpl authConfigFactory = new AuthConfigFactoryImpl(jaspi1, callbackHandler);
+
+ AuthConfigProvider configProvider = authConfigFactory.getConfigProvider("Http", "test-app1", null);
+// adapter.unmarshal(jaspi1.getConfigProvider()).get(ConfigProviderType.getRegistrationKey("Http", "test-app1")).getProvider();
checkConfigProvider(configProvider);
}
@@ -93,9 +100,9 @@
return rbac;
}
- private Reader getReader(String file) throws UnsupportedEncodingException {
+ private Reader getReader(String file) {
InputStream in = getClass().getClassLoader().getResourceAsStream("test-" + file + ".xml");
- Reader reader = new InputStreamReader(in, "UTF-8");
+ Reader reader = new InputStreamReader(in);
return reader;
}
@@ -110,13 +117,13 @@
String file = "config-provider";
Reader reader = getReader(file);
ConfigProviderType jaspi1 = JaspiXmlUtil.loadConfigProvider(reader);
- jaspi1.initialize(callbackHandler);
+// jaspi1.initialize(callbackHandler);
File newFile = getWriteFile(file);
- Writer writer = getWriter(newFile);
+ Writer writer = new FileWriter(newFile);
JaspiXmlUtil.writeConfigProvider(jaspi1, writer);
ConfigProviderType jaspi2 = JaspiXmlUtil.loadConfigProvider(new FileReader(newFile));
- AuthConfigProvider configProvider = jaspi1.getProvider();
+ AuthConfigProvider configProvider = ConfigProviderImpl.newConfigProvider(null, jaspi1);
checkConfigProvider(configProvider);
}
@@ -125,13 +132,13 @@
String file = "client-auth-config";
Reader reader = getReader(file);
ClientAuthConfigType jaspi1 = JaspiXmlUtil.loadClientAuthConfig(reader);
- jaspi1.initialize(callbackHandler);
+// jaspi1.initialize(callbackHandler);
File newFile = getWriteFile(file);
- Writer writer = getWriter(newFile);
+ Writer writer = new FileWriter(newFile);
JaspiXmlUtil.writeClientAuthConfig(jaspi1, writer);
ClientAuthConfigType jaspi2 = JaspiXmlUtil.loadClientAuthConfig(new FileReader(newFile));
- ClientAuthConfig clientAuthConfig = jaspi1.newClientAuthConfig("Http", "app", callbackHandler);
+ ClientAuthConfig clientAuthConfig = ConfigProviderImpl.newClientAuthConfig(jaspi1, "Http", "app", callbackHandler);
checkClientAuthConfig(clientAuthConfig);
}
@@ -141,30 +148,25 @@
Reader reader = getReader(file);
ClientAuthContextType jaspi1 = JaspiXmlUtil.loadClientAuthContext(reader);
File newFile = getWriteFile(file);
- Writer writer = getWriter(newFile);
+ Writer writer = new FileWriter(newFile);
JaspiXmlUtil.writeClientAuthContext(jaspi1, writer);
ClientAuthContextType jaspi2 = JaspiXmlUtil.loadClientAuthContext(new FileReader(newFile));
- ClientAuthContext clientAuthConfig = jaspi1.newClientAuthContext(callbackHandler);
+ ClientAuthContext clientAuthConfig = ConfigProviderImpl.newClientAuthContext(jaspi1, callbackHandler);
clientAuthConfig.secureRequest(null, null);
}
- private Writer getWriter(File newFile) throws IOException {
- FileOutputStream out = new FileOutputStream(newFile);
- return new OutputStreamWriter(out, "UTF-8");//new FileWriter(newFile);
- }
-
@Test
public void testClientAuthModule() throws Exception {
String file = "client-auth-module";
Reader reader = getReader(file);
AuthModuleType<ClientAuthModule> jaspi1 = JaspiXmlUtil.loadClientAuthModule(reader);
File newFile = getWriteFile(file);
- Writer writer = getWriter(newFile);
+ Writer writer = new FileWriter(newFile);
JaspiXmlUtil.writeClientAuthModule(jaspi1, writer);
AuthModuleType jaspi2 = JaspiXmlUtil.loadClientAuthModule(new FileReader(newFile));
- ClientAuthModule clientAuthConfig = jaspi1.newAuthModule(callbackHandler);
+ ClientAuthModule clientAuthConfig =ConfigProviderImpl.newAuthModule(jaspi1, callbackHandler);
clientAuthConfig.secureRequest(null, null);
}