Author: alessio.soldano(a)jboss.com
Date: 2011-04-26 17:48:29 -0400 (Tue, 26 Apr 2011)
New Revision: 14202
Modified:
stack/cxf/branches/cxf24/modules/server/src/main/java/org/jboss/wsf/stack/cxf/security/authentication/SubjectCreatingInterceptor.java
stack/cxf/branches/cxf24/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/CustomSubjectCreatingInterceptor.java
stack/cxf/branches/cxf24/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/ServerUsernamePasswordCallback.java
Log:
Updating UT callback handlers to WSS4J 1.6
Modified:
stack/cxf/branches/cxf24/modules/server/src/main/java/org/jboss/wsf/stack/cxf/security/authentication/SubjectCreatingInterceptor.java
===================================================================
---
stack/cxf/branches/cxf24/modules/server/src/main/java/org/jboss/wsf/stack/cxf/security/authentication/SubjectCreatingInterceptor.java 2011-04-26
14:14:15 UTC (rev 14201)
+++
stack/cxf/branches/cxf24/modules/server/src/main/java/org/jboss/wsf/stack/cxf/security/authentication/SubjectCreatingInterceptor.java 2011-04-26
21:48:29 UTC (rev 14202)
@@ -25,6 +25,7 @@
import java.security.Principal;
import java.util.Calendar;
import java.util.Collections;
+import java.util.HashMap;
import java.util.Map;
import javax.security.auth.Subject;
@@ -69,7 +70,7 @@
public SubjectCreatingInterceptor()
{
- this(Collections.<String, Object> emptyMap());
+ this(new HashMap<String, Object>());
}
public SubjectCreatingInterceptor(Map<String, Object> properties)
Modified:
stack/cxf/branches/cxf24/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/CustomSubjectCreatingInterceptor.java
===================================================================
---
stack/cxf/branches/cxf24/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/CustomSubjectCreatingInterceptor.java 2011-04-26
14:14:15 UTC (rev 14201)
+++
stack/cxf/branches/cxf24/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/CustomSubjectCreatingInterceptor.java 2011-04-26
21:48:29 UTC (rev 14202)
@@ -21,7 +21,9 @@
*/
package org.jboss.test.ws.jaxws.samples.wsse;
-import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
import org.jboss.wsf.stack.cxf.security.authentication.SubjectCreatingInterceptor;
import org.picketbox.config.PicketBoxConfiguration;
import org.picketbox.exceptions.ConfigurationStreamNullException;
@@ -39,7 +41,7 @@
public CustomSubjectCreatingInterceptor()
{
- super(Collections.<String, Object> singletonMap("action",
"UsernameToken"));
+ super(getInitMap());
}
public void setSecurityConfigFile(String configFilePath)
@@ -62,5 +64,10 @@
}
}
-
+ private static Map<String, Object> getInitMap()
+ {
+ Map<String, Object> map = new HashMap<String, Object>();
+ map.put("action", "UsernameToken");
+ return map;
+ }
}
Modified:
stack/cxf/branches/cxf24/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/ServerUsernamePasswordCallback.java
===================================================================
---
stack/cxf/branches/cxf24/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/ServerUsernamePasswordCallback.java 2011-04-26
14:14:15 UTC (rev 14201)
+++
stack/cxf/branches/cxf24/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/ServerUsernamePasswordCallback.java 2011-04-26
21:48:29 UTC (rev 14202)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
@@ -33,7 +33,10 @@
public void handle(Callback[] callbacks) throws IOException,
UnsupportedCallbackException
{
WSPasswordCallback pc = (WSPasswordCallback)callbacks[0];
- if (!("kermit".equals(pc.getIdentifier()) &&
"thefrog".equals(pc.getPassword())))
- throw new SecurityException("User '" + pc.getIdentifier() +
"' with password '" + pc.getPassword() + "' not
allowed.");
+ //this CallbackHandler is meant for use with WSS4J 1.6, see
http://ws.apache.org/wss4j/wss4j16.html
+ if ("kermit".equals(pc.getIdentifier()))
+ {
+ pc.setPassword("thefrog");
+ }
}
}