You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2011/05/02 23:43:19 UTC
svn commit: r1098801 [2/2] - in /geronimo/components/jaspi/trunk: ./
geronimo-jaspi/
geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/
geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/impl/
geronimo-jaspi/src/main/java...
Modified: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/JaspiType.java
URL: http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/JaspiType.java?rev=1098801&r1=1098800&r2=1098801&view=diff
==============================================================================
--- geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/JaspiType.java (original)
+++ geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/JaspiType.java Mon May 2 21:43:18 2011
@@ -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 @@ import javax.xml.bind.annotation.adapter
* </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 @@ public class JaspiType
{
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 @@ public class JaspiType
* {@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;
}
Modified: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/JaspiUtil.java
URL: http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/JaspiUtil.java?rev=1098801&r1=1098800&r2=1098801&view=diff
==============================================================================
--- geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/JaspiUtil.java (original)
+++ geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/JaspiUtil.java Mon May 2 21:43:18 2011
@@ -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 class JaspiUtil {
}
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 class JaspiUtil {
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 {
Modified: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/JaspiXmlUtil.java
URL: http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/JaspiXmlUtil.java?rev=1098801&r1=1098800&r2=1098801&view=diff
==============================================================================
--- geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/JaspiXmlUtil.java (original)
+++ geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/JaspiXmlUtil.java Mon May 2 21:43:18 2011
@@ -23,7 +23,6 @@ package org.apache.geronimo.components.j
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 javax.xml.stream.XMLStreamReader;
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 @@ public class JaspiXmlUtil {
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);
Modified: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/KeyedObject.java
URL: http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/KeyedObject.java?rev=1098801&r1=1098800&r2=1098801&view=diff
==============================================================================
--- geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/KeyedObject.java (original)
+++ geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/KeyedObject.java Mon May 2 21:43:18 2011
@@ -24,10 +24,8 @@ import javax.security.auth.callback.Call
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();
}
Modified: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/KeyedObjectMapAdapter.java
URL: http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/KeyedObjectMapAdapter.java?rev=1098801&r1=1098800&r2=1098801&view=diff
==============================================================================
--- geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/KeyedObjectMapAdapter.java (original)
+++ geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/KeyedObjectMapAdapter.java Mon May 2 21:43:18 2011
@@ -30,47 +30,43 @@ import javax.security.auth.callback.Call
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;
}
}
Modified: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/MessagePolicyType.java
URL: http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/MessagePolicyType.java?rev=1098801&r1=1098800&r2=1098801&view=diff
==============================================================================
--- geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/MessagePolicyType.java (original)
+++ geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/MessagePolicyType.java Mon May 2 21:43:18 2011
@@ -55,7 +55,7 @@ import javax.xml.bind.annotation.XmlType
* </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 @@ public class MessagePolicyType
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);
- }
}
Modified: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ProtectionPolicyType.java
URL: http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ProtectionPolicyType.java?rev=1098801&r1=1098800&r2=1098801&view=diff
==============================================================================
--- geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ProtectionPolicyType.java (original)
+++ geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ProtectionPolicyType.java Mon May 2 21:43:18 2011
@@ -57,7 +57,7 @@ import org.apache.geronimo.osgi.locator.
* </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 @@ public class ProtectionPolicyType
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);
- }
- }
}
Modified: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ServerAuthConfigType.java
URL: http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ServerAuthConfigType.java?rev=1098801&r1=1098800&r2=1098801&view=diff
==============================================================================
--- geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ServerAuthConfigType.java (original)
+++ geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ServerAuthConfigType.java Mon May 2 21:43:18 2011
@@ -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.XmlAcce
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 @@ import javax.xml.bind.annotation.adapter
* </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 @@ public class ServerAuthConfigType
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 @@ public class ServerAuthConfigType
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 @@ public class ServerAuthConfigType
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 @@ public class ServerAuthConfigType
*
* @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 {
- }
- }
}
Modified: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ServerAuthContextType.java
URL: http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ServerAuthContextType.java?rev=1098801&r1=1098800&r2=1098801&view=diff
==============================================================================
--- geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ServerAuthContextType.java (original)
+++ geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/ServerAuthContextType.java Mon May 2 21:43:18 2011
@@ -29,10 +29,8 @@ import java.util.ArrayList;
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.XmlAcce
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 @@ import javax.xml.bind.annotation.XmlType
* </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 @@ import javax.xml.bind.annotation.XmlType
"serverAuthModule"
})
public class ServerAuthContextType
- implements Serializable, KeyedObject {
+ implements Serializable {
private final static long serialVersionUID = 12343L;
protected String messageLayer;
@@ -81,10 +80,6 @@ public class ServerAuthContextType
protected String authenticationContextID;
protected List<AuthModuleType<ServerAuthModule>> serverAuthModule;
- @XmlTransient
- private ServerAuthContext serverAuthContext;
-
-
public ServerAuthContextType() {
}
@@ -187,94 +182,4 @@ public class ServerAuthContextType
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;
- }
-
- }
-
}
Modified: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/StringMapAdapter.java
URL: http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/StringMapAdapter.java?rev=1098801&r1=1098800&r2=1098801&view=diff
==============================================================================
--- geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/StringMapAdapter.java (original)
+++ geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/StringMapAdapter.java Mon May 2 21:43:18 2011
@@ -31,7 +31,7 @@ import javax.xml.bind.annotation.adapter
/**
* 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 {
Modified: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/TargetPolicyType.java
URL: http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/TargetPolicyType.java?rev=1098801&r1=1098800&r2=1098801&view=diff
==============================================================================
--- geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/TargetPolicyType.java (original)
+++ geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/TargetPolicyType.java Mon May 2 21:43:18 2011
@@ -55,7 +55,7 @@ import javax.xml.bind.annotation.XmlType
* </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 @@ public class TargetPolicyType
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());
- }
}
Modified: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/TargetType.java
URL: http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/TargetType.java?rev=1098801&r1=1098800&r2=1098801&view=diff
==============================================================================
--- geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/TargetType.java (original)
+++ geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/TargetType.java Mon May 2 21:43:18 2011
@@ -57,7 +57,7 @@ import org.apache.geronimo.osgi.locator.
* </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 @@ public class TargetType
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);
- }
-
- }
-
}
Modified: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/package-info.java
URL: http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/package-info.java?rev=1098801&r1=1098800&r2=1098801&view=diff
==============================================================================
--- geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/package-info.java (original)
+++ geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/java/org/apache/geronimo/components/jaspi/model/package-info.java Mon May 2 21:43:18 2011
@@ -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;
Modified: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/resources/META-INF/sun-jaxb.episode
URL: http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/resources/META-INF/sun-jaxb.episode?rev=1098801&r1=1098800&r2=1098801&view=diff
==============================================================================
--- geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/resources/META-INF/sun-jaxb.episode (original)
+++ geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/resources/META-INF/sun-jaxb.episode Mon May 2 21:43:18 2011
@@ -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>
Copied: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/resources/geronimo-jaspi.xsd (from r1096035, geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/xsd/geronimo-jaspi.xsd)
URL: http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/resources/geronimo-jaspi.xsd?p2=geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/resources/geronimo-jaspi.xsd&p1=geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/xsd/geronimo-jaspi.xsd&r1=1096035&r2=1098801&rev=1098801&view=diff
==============================================================================
(empty)
Propchange: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/resources/geronimo-jaspi.xsd
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/resources/geronimo-jaspi.xsd
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/components/jaspi/trunk/geronimo-jaspi/src/main/resources/geronimo-jaspi.xsd
------------------------------------------------------------------------------
svn:mime-type = text/xml
Copied: geronimo/components/jaspi/trunk/geronimo-jaspi/src/test/java/org/apache/geronimo/components/jaspi/impl/JaxbTest.java (from r1096035, geronimo/components/jaspi/trunk/geronimo-jaspi/src/test/java/org/apache/geronimo/components/jaspi/model/JaxbTest.java)
URL: http://svn.apache.org/viewvc/geronimo/components/jaspi/trunk/geronimo-jaspi/src/test/java/org/apache/geronimo/components/jaspi/impl/JaxbTest.java?p2=geronimo/components/jaspi/trunk/geronimo-jaspi/src/test/java/org/apache/geronimo/components/jaspi/impl/JaxbTest.java&p1=geronimo/components/jaspi/trunk/geronimo-jaspi/src/test/java/org/apache/geronimo/components/jaspi/model/JaxbTest.java&r1=1096035&r2=1098801&rev=1098801&view=diff
==============================================================================
--- geronimo/components/jaspi/trunk/geronimo-jaspi/src/test/java/org/apache/geronimo/components/jaspi/model/JaxbTest.java (original)
+++ geronimo/components/jaspi/trunk/geronimo-jaspi/src/test/java/org/apache/geronimo/components/jaspi/impl/JaxbTest.java Mon May 2 21:43:18 2011
@@ -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.AuthE
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 @@ public class JaxbTest {
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 @@ public class JaxbTest {
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 @@ public class JaxbTest {
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 @@ public class JaxbTest {
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 @@ public class JaxbTest {
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 @@ public class JaxbTest {
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);
}
Propchange: geronimo/components/jaspi/trunk/geronimo-jaspi/src/test/java/org/apache/geronimo/components/jaspi/impl/JaxbTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/components/jaspi/trunk/geronimo-jaspi/src/test/java/org/apache/geronimo/components/jaspi/impl/JaxbTest.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/components/jaspi/trunk/geronimo-jaspi/src/test/java/org/apache/geronimo/components/jaspi/impl/JaxbTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain