JBossWS SVN: r8958 - stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/client.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2008-12-23 11:04:54 -0500 (Tue, 23 Dec 2008)
New Revision: 8958
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java
Log:
Prevent exception when SOAPHandler.getHeaders() return null
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java 2008-12-19 17:39:19 UTC (rev 8957)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java 2008-12-23 16:04:54 UTC (rev 8958)
@@ -502,7 +502,11 @@
for (Handler bindingHandler : binding.getHandlerChain(type))
{
if (bindingHandler instanceof SOAPHandler)
- headers.addAll(((SOAPHandler)bindingHandler).getHeaders());
+ {
+ Set<QName> understoodHeaders = ((SOAPHandler)bindingHandler).getHeaders();
+ if (understoodHeaders != null)
+ headers.addAll(understoodHeaders);
+ }
}
}
16 years
JBossWS SVN: r8957 - in stack/native/branches/dlofthouse/JBWS-1999/modules: testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1999 and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2008-12-19 12:39:19 -0500 (Fri, 19 Dec 2008)
New Revision: 8957
Added:
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-default-role-unchecked.xml
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-default-role.xml
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-default-unchecked.xml
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-port-role-unchecked.xml
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-port-role.xml
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-port-roles.xml
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-port-unchecked.xml
Modified:
stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/metadata/wsse/Authorize.java
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1999/JBWS1999ConfigurationTestCase.java
Log:
Completion of configuration test case.
Modified: stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/metadata/wsse/Authorize.java
===================================================================
--- stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/metadata/wsse/Authorize.java 2008-12-18 18:06:14 UTC (rev 8956)
+++ stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/metadata/wsse/Authorize.java 2008-12-19 17:39:19 UTC (rev 8957)
@@ -47,6 +47,10 @@
public void addRole(final Role role)
{
+ if (isUnchecked())
+ {
+ throw new IllegalStateException("Can not add role after setting 'Unchecked'");
+ }
roles.add(role);
}
@@ -57,6 +61,10 @@
void setUnchecked(Unchecked unchecked)
{
+ if (roles.isEmpty() == false)
+ {
+ throw new IllegalStateException("Can not set 'Unchecked' with role(s) defined.");
+ }
this.unchecked = unchecked;
}
Modified: stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1999/JBWS1999ConfigurationTestCase.java
===================================================================
--- stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1999/JBWS1999ConfigurationTestCase.java 2008-12-18 18:06:14 UTC (rev 8956)
+++ stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1999/JBWS1999ConfigurationTestCase.java 2008-12-19 17:39:19 UTC (rev 8957)
@@ -28,6 +28,7 @@
import org.jboss.ws.metadata.wsse.Authorize;
import org.jboss.ws.metadata.wsse.Config;
+import org.jboss.ws.metadata.wsse.Port;
import org.jboss.ws.metadata.wsse.Role;
import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
import org.jboss.ws.metadata.wsse.WSSecurityOMFactory;
@@ -60,6 +61,7 @@
Config config = wsConfig.getDefaultConfig();
Authorize authorize = config.getAuthorize();
+ assertFalse("Unchecked", authorize.isUnchecked());
List<Role> roles = authorize.getRoles();
assertEquals("Expected 2 roles", 2, roles.size());
@@ -73,4 +75,137 @@
assertTrue("Expected 'Banker' role.", roleNames.contains("Banker"));
}
+ /**
+ * Test loading a configuration with a port 'authorize' definition
+ * which contains two roles.
+ */
+ public void testPortRoles() throws Exception
+ {
+ WSSecurityConfiguration wsConfig = load("jboss-wsse-port-roles.xml");
+
+ Port port = wsConfig.getPorts().get("TestPort");
+ Config config = port.getDefaultConfig();
+ Authorize authorize = config.getAuthorize();
+ assertFalse("Unchecked", authorize.isUnchecked());
+ List<Role> roles = authorize.getRoles();
+
+ assertEquals("Expected 2 roles", 2, roles.size());
+
+ List<String> roleNames = new ArrayList<String>(roles.size());
+ for (Role current : roles)
+ {
+ roleNames.add(current.getName());
+ }
+ assertTrue("Expected 'Trader' role.", roleNames.contains("Trader"));
+ assertTrue("Expected 'Banker' role.", roleNames.contains("Banker"));
+ }
+
+ /**
+ * Test loading a configuration with a default 'authorize' definition
+ * which contains one role.
+ */
+ public void testDefaultRole() throws Exception
+ {
+ WSSecurityConfiguration wsConfig = load("jboss-wsse-default-role.xml");
+
+ Config config = wsConfig.getDefaultConfig();
+ Authorize authorize = config.getAuthorize();
+ assertFalse("Unchecked", authorize.isUnchecked());
+ List<Role> roles = authorize.getRoles();
+
+ assertEquals("Expected 1 roles", 1, roles.size());
+
+ Role role = roles.get(0);
+ assertEquals("Expected 'Trader' role.", "Trader", role.getName());
+ }
+
+ /**
+ * Test loading a configuration with a port 'authorize' definition
+ * which contains one role.
+ */
+ public void testPortRole() throws Exception
+ {
+ WSSecurityConfiguration wsConfig = load("jboss-wsse-port-role.xml");
+
+ Port port = wsConfig.getPorts().get("TestPort");
+ Config config = port.getDefaultConfig();
+ Authorize authorize = config.getAuthorize();
+ assertFalse("Unchecked", authorize.isUnchecked());
+ List<Role> roles = authorize.getRoles();
+
+ assertEquals("Expected 1 roles", 1, roles.size());
+
+ Role role = roles.get(0);
+ assertEquals("Expected 'Trader' role.", "Trader", role.getName());
+ }
+
+ /**
+ * Test loading a configuration with a default 'authorize' definition
+ * with unchecked.
+ */
+ public void testDefaultUnchecked() throws Exception
+ {
+ WSSecurityConfiguration wsConfig = load("jboss-wsse-default-unchecked.xml");
+
+ Config config = wsConfig.getDefaultConfig();
+ Authorize authorize = config.getAuthorize();
+ assertTrue("Unchecked", authorize.isUnchecked());
+ List<Role> roles = authorize.getRoles();
+
+ assertEquals("Expected 0 roles", 0, roles.size());
+ }
+
+ /**
+ * Test loading a configuration with a port 'authorize' definition
+ * with unchecked.
+ */
+ public void testPortUnchecked() throws Exception
+ {
+ WSSecurityConfiguration wsConfig = load("jboss-wsse-port-unchecked.xml");
+
+ Port port = wsConfig.getPorts().get("TestPort");
+ Config config = port.getDefaultConfig();
+ Authorize authorize = config.getAuthorize();
+ assertTrue("Unchecked", authorize.isUnchecked());
+ List<Role> roles = authorize.getRoles();
+
+ assertEquals("Expected 0 roles", 0, roles.size());
+ }
+
+ /**
+ * Test loading a configuration with a default 'authorize' definition
+ * with unchecked and a role defined, parsing should fail.
+ */
+ public void testDefaultRoleUnchecked() throws Exception
+ {
+ try
+ {
+ WSSecurityConfiguration wsConfig = load("jboss-wsse-default-role-unchecked.xml");
+ fail("Expected exception not thrown.");
+ }
+ catch (IOException expected)
+ {
+ Throwable cause = expected.getCause();
+ assertEquals(IllegalStateException.class, cause.getClass());
+ }
+ }
+
+ /**
+ * Test loading a configuration with a port 'authorize' definition
+ * with unchecked and a role defined, parsing should fail.
+ */
+ public void testPortRoleUnchecked() throws Exception
+ {
+ try
+ {
+ WSSecurityConfiguration wsConfig = load("jboss-wsse-port-role-unchecked.xml");
+ fail("Expected exception not thrown.");
+ }
+ catch (IOException expected)
+ {
+ Throwable cause = expected.getCause();
+ assertEquals(IllegalStateException.class, cause.getClass());
+ }
+ }
+
}
Added: stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-default-role-unchecked.xml
===================================================================
--- stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-default-role-unchecked.xml (rev 0)
+++ stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-default-role-unchecked.xml 2008-12-19 17:39:19 UTC (rev 8957)
@@ -0,0 +1,12 @@
+<jboss-ws-security xmlns='http://www.jboss.com/ws-security/config'
+ xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
+ xsi:schemaLocation='http://www.jboss.com/ws-security/config http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd'>
+
+ <config>
+ <authorize>
+ <role>Trader</role>
+ <unchecked/>
+ </authorize>
+ </config>
+
+</jboss-ws-security>
\ No newline at end of file
Property changes on: stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-default-role-unchecked.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-default-role.xml
===================================================================
--- stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-default-role.xml (rev 0)
+++ stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-default-role.xml 2008-12-19 17:39:19 UTC (rev 8957)
@@ -0,0 +1,11 @@
+<jboss-ws-security xmlns='http://www.jboss.com/ws-security/config'
+ xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
+ xsi:schemaLocation='http://www.jboss.com/ws-security/config http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd'>
+
+ <config>
+ <authorize>
+ <role>Trader</role>
+ </authorize>
+ </config>
+
+</jboss-ws-security>
\ No newline at end of file
Property changes on: stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-default-role.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-default-unchecked.xml
===================================================================
--- stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-default-unchecked.xml (rev 0)
+++ stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-default-unchecked.xml 2008-12-19 17:39:19 UTC (rev 8957)
@@ -0,0 +1,11 @@
+<jboss-ws-security xmlns='http://www.jboss.com/ws-security/config'
+ xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
+ xsi:schemaLocation='http://www.jboss.com/ws-security/config http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd'>
+
+ <config>
+ <authorize>
+ <unchecked/>
+ </authorize>
+ </config>
+
+</jboss-ws-security>
\ No newline at end of file
Property changes on: stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-default-unchecked.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-port-role-unchecked.xml
===================================================================
--- stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-port-role-unchecked.xml (rev 0)
+++ stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-port-role-unchecked.xml 2008-12-19 17:39:19 UTC (rev 8957)
@@ -0,0 +1,20 @@
+<jboss-ws-security xmlns='http://www.jboss.com/ws-security/config'
+ xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
+ xsi:schemaLocation='http://www.jboss.com/ws-security/config http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd'>
+
+ <config>
+ <authorize>
+ <role>Trader</role>
+ </authorize>
+ </config>
+
+ <port name="TestPort">
+ <config>
+ <authorize>
+ <role>Trader</role>
+ <unchecked/>
+ </authorize>
+ </config>
+ </port>
+
+</jboss-ws-security>
\ No newline at end of file
Property changes on: stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-port-role-unchecked.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-port-role.xml
===================================================================
--- stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-port-role.xml (rev 0)
+++ stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-port-role.xml 2008-12-19 17:39:19 UTC (rev 8957)
@@ -0,0 +1,19 @@
+<jboss-ws-security xmlns='http://www.jboss.com/ws-security/config'
+ xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
+ xsi:schemaLocation='http://www.jboss.com/ws-security/config http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd'>
+
+ <config>
+ <authorize>
+ <unchecked/>
+ </authorize>
+ </config>
+
+ <port name="TestPort">
+ <config>
+ <authorize>
+ <role>Trader</role>
+ </authorize>
+ </config>
+ </port>
+
+</jboss-ws-security>
\ No newline at end of file
Property changes on: stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-port-role.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-port-roles.xml
===================================================================
--- stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-port-roles.xml (rev 0)
+++ stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-port-roles.xml 2008-12-19 17:39:19 UTC (rev 8957)
@@ -0,0 +1,20 @@
+<jboss-ws-security xmlns='http://www.jboss.com/ws-security/config'
+ xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
+ xsi:schemaLocation='http://www.jboss.com/ws-security/config http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd'>
+
+ <config>
+ <authorize>
+ <unchecked/>
+ </authorize>
+ </config>
+
+ <port name="TestPort">
+ <config>
+ <authorize>
+ <role>Banker</role>
+ <role>Trader</role>
+ </authorize>
+ </config>
+ </port>
+
+</jboss-ws-security>
\ No newline at end of file
Property changes on: stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-port-roles.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-port-unchecked.xml
===================================================================
--- stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-port-unchecked.xml (rev 0)
+++ stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-port-unchecked.xml 2008-12-19 17:39:19 UTC (rev 8957)
@@ -0,0 +1,19 @@
+<jboss-ws-security xmlns='http://www.jboss.com/ws-security/config'
+ xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
+ xsi:schemaLocation='http://www.jboss.com/ws-security/config http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd'>
+
+ <config>
+ <authorize>
+ <role>Trader</role>
+ </authorize>
+ </config>
+
+ <port name="TestPort">
+ <config>
+ <authorize>
+ <unchecked/>
+ </authorize>
+ </config>
+ </port>
+
+</jboss-ws-security>
\ No newline at end of file
Property changes on: stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-port-unchecked.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
16 years
JBossWS SVN: r8956 - in stack/native/branches/dlofthouse/JBWS-1999/modules: core/src/main/resources/schema and 2 other directories.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2008-12-18 13:06:14 -0500 (Thu, 18 Dec 2008)
New Revision: 8956
Added:
stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/metadata/wsse/Authorize.java
stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/metadata/wsse/Role.java
stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/metadata/wsse/Unchecked.java
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1999/JBWS1999ConfigurationTestCase.java
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-default-roles.xml
Modified:
stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/metadata/wsse/Config.java
stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/metadata/wsse/WSSecurityOMFactory.java
stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/resources/schema/jboss-ws-security_1_0.xsd
Log:
New configuration and test case for reading configuration.
Added: stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/metadata/wsse/Authorize.java
===================================================================
--- stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/metadata/wsse/Authorize.java (rev 0)
+++ stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/metadata/wsse/Authorize.java 2008-12-18 18:06:14 UTC (rev 8956)
@@ -0,0 +1,63 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2008, 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.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.ws.metadata.wsse;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * <code>Authorize</code> specifies that the users credentials should be
+ * checked to ensure the user is authorized to call the endpoint.
+ *
+ * @author <a href="mailto:darran.lofthouse@jboss.com">Darran Lofthouse</a>
+ * @since December 18th 2008
+ */
+public class Authorize implements Serializable
+{
+
+ private Unchecked unchecked;
+
+ private List<Role> roles = new ArrayList<Role>();
+
+ public List<Role> getRoles()
+ {
+ return Collections.unmodifiableList(roles);
+ }
+
+ public void addRole(final Role role)
+ {
+ roles.add(role);
+ }
+
+ public boolean isUnchecked()
+ {
+ return unchecked != null;
+ }
+
+ void setUnchecked(Unchecked unchecked)
+ {
+ this.unchecked = unchecked;
+ }
+
+}
Property changes on: stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/metadata/wsse/Authorize.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/metadata/wsse/Config.java
===================================================================
--- stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/metadata/wsse/Config.java 2008-12-18 16:47:44 UTC (rev 8955)
+++ stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/metadata/wsse/Config.java 2008-12-18 18:06:14 UTC (rev 8956)
@@ -38,6 +38,7 @@
private Encrypt encrypt;
private Requires requires;
private Authenticate authenticate;
+ private Authorize authorize;
public Encrypt getEncrypt()
{
@@ -98,4 +99,14 @@
{
this.authenticate = authenticate;
}
+
+ public Authorize getAuthorize()
+ {
+ return this.authorize;
+ }
+
+ public void setAuthorize(Authorize authorize)
+ {
+ this.authorize = authorize;
+ }
}
Added: stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/metadata/wsse/Role.java
===================================================================
--- stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/metadata/wsse/Role.java (rev 0)
+++ stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/metadata/wsse/Role.java 2008-12-18 18:06:14 UTC (rev 8956)
@@ -0,0 +1,53 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2008, 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.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.ws.metadata.wsse;
+
+import java.io.Serializable;
+
+/**
+ * <code>Role</code> representation of a role authorized to call an endpoint.
+ *
+ * @author <a href="mailto:darran.lofthouse@jboss.com">Darran Lofthouse</a>
+ * @since December 18th 2008
+ */
+public class Role implements Serializable
+{
+
+ private String name;
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ @Override
+ public String toString()
+ {
+ return this.name;
+ }
+
+}
Property changes on: stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/metadata/wsse/Role.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/metadata/wsse/Unchecked.java
===================================================================
--- stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/metadata/wsse/Unchecked.java (rev 0)
+++ stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/metadata/wsse/Unchecked.java 2008-12-18 18:06:14 UTC (rev 8956)
@@ -0,0 +1,35 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2008, 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.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.ws.metadata.wsse;
+
+import java.io.Serializable;
+
+/**
+ * <code>Unchecked</code> used when all authenticated users are authorized.
+ *
+ * @author <a href="mailto:darran.lofthouse@jboss.com">Darran Lofthouse</a>
+ * @since December 18th 2008
+ */
+public class Unchecked implements Serializable
+{
+
+}
Property changes on: stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/metadata/wsse/Unchecked.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/metadata/wsse/WSSecurityOMFactory.java
===================================================================
--- stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/metadata/wsse/WSSecurityOMFactory.java 2008-12-18 16:47:44 UTC (rev 8955)
+++ stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/metadata/wsse/WSSecurityOMFactory.java 2008-12-18 18:06:14 UTC (rev 8956)
@@ -307,6 +307,10 @@
{
return new Authenticate();
}
+ else if ("authorize".equals(localName))
+ {
+ return new Authorize();
+ }
return null;
}
@@ -363,7 +367,7 @@
{
log.trace("addChild: [obj=" + config + ",child=" + authenticate + "]");
config.setAuthenticate(authenticate);
- }
+ }
/**
* Called when parsing character is complete.
@@ -372,7 +376,7 @@
{
log.trace("addChild: [obj=" + authenticate + ",child=" + usernameAuth + "]");
authenticate.setUsernameAuth(usernameAuth);
- }
+ }
/**
* Called when parsing character is complete.
@@ -382,7 +386,34 @@
log.trace("addChild: [obj=" + authenticate + ",child=" + signatureCertAuth + "]");
authenticate.setSignatureCertAuth(signatureCertAuth);
}
-
+
+ /**
+ * Called when parsing character is complete.
+ */
+ public void addChild(Config config, Authorize authorize, UnmarshallingContext navigator, String namespaceURI, String localName)
+ {
+ log.trace("addChild: [obj=" + config + ",child=" + authorize + "]");
+ config.setAuthorize(authorize);
+ }
+
+ /**
+ * Called when parsing character is complete.
+ */
+ public void addChild(Authorize authorize, Unchecked unchecked, UnmarshallingContext navigator, String namespaceURI, String localName)
+ {
+ log.trace("addChild: [obj=" + authorize + ",child=" + unchecked + "]");
+ authorize.setUnchecked(unchecked);
+ }
+
+ /**
+ * Called when parsing character is complete.
+ */
+ public void addChild(Authorize authorize, Role role, UnmarshallingContext navigator, String namespaceURI, String localName)
+ {
+ log.trace("addChild: [obj=" + authorize + ",child=" + role + "]");
+ authorize.addRole(role);
+ }
+
private Object handleTargets(Object object, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
{
log.trace("newChild: " + localName);
@@ -452,7 +483,25 @@
return null;
}
+
+ /**
+ * Called when parsing of a new element started.
+ */
+ public Object newChild(Authorize authorize, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
+ {
+ log.trace("newChild: " + localName);
+ if ("unchecked".equals(localName))
+ {
+ return new Unchecked();
+ }
+ else if ("role".equals(localName))
+ {
+ return new Role();
+ }
+ return null;
+ }
+
/**
* Called when parsing of a new element started.
*/
@@ -475,7 +524,14 @@
target.setValue(value);
}
+
+ public void setValue(Role role, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
+ {
+ log.trace("setValue: [obj=" + role + ",value=" + value + "]");
+ role.setName(value);
+ }
+
/**
* Called when parsing character is complete.
*/
Modified: stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/resources/schema/jboss-ws-security_1_0.xsd
===================================================================
--- stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/resources/schema/jboss-ws-security_1_0.xsd 2008-12-18 16:47:44 UTC (rev 8955)
+++ stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/resources/schema/jboss-ws-security_1_0.xsd 2008-12-18 18:06:14 UTC (rev 8956)
@@ -136,6 +136,16 @@
<xs:documentation>Specifies the token to be used for JAAS authentication. If this is not specified, the username token will be used if available.</xs:documentation>
</xs:annotation>
</xs:element>
+ <xs:element name="authorize" type="authorizeType" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>
+ Specifies that authentication is required and either provides a list of roles authorized to access the endpoint or unchecked if any
+ authenticated user can access the endpoint.
+
+ This should only be used for POJO endpoints, EJB3 endpoints should configure security as for any other EJB3 session bean.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
</xs:all>
</xs:complexType>
<xs:complexType name="requireTimestampType">
@@ -351,4 +361,19 @@
</xs:annotation>
</xs:attribute>
</xs:complexType>
+ <xs:complexType name="authorizeType">
+ <xs:choice minOccurs="1" maxOccurs="1">
+ <xs:element name="role" type="xs:string" minOccurs="0" maxOccurs="unbounded">
+ <xs:annotation>
+ <xs:documentation>Specifies a role that is allowed to call the endpoint.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="unchecked" type="uncheckedType" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>Specifies that any authenticated user can call the endpoint.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ </xs:choice>
+ </xs:complexType>
+ <xs:complexType name="uncheckedType"/>
</xs:schema>
Added: stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1999/JBWS1999ConfigurationTestCase.java
===================================================================
--- stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1999/JBWS1999ConfigurationTestCase.java (rev 0)
+++ stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1999/JBWS1999ConfigurationTestCase.java 2008-12-18 18:06:14 UTC (rev 8956)
@@ -0,0 +1,76 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2008, 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.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.ws.jaxws.jbws1999;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.ws.metadata.wsse.Authorize;
+import org.jboss.ws.metadata.wsse.Config;
+import org.jboss.ws.metadata.wsse.Role;
+import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
+import org.jboss.ws.metadata.wsse.WSSecurityOMFactory;
+import org.jboss.wsf.test.JBossWSTest;
+
+/**
+ * Test case to test reading the 'authorize' configuration.
+ *
+ * @author <a href="mailto:darran.lofthouse@jboss.com">Darran Lofthouse</a>
+ * @since December 18th 2008
+ */
+public class JBWS1999ConfigurationTestCase extends JBossWSTest
+{
+
+ private WSSecurityConfiguration load(final String fileName) throws IOException
+ {
+ File configFile = getResourceFile("jaxws/jbws1999/config/" + fileName);
+ WSSecurityOMFactory factory = WSSecurityOMFactory.newInstance();
+
+ return factory.parse(configFile.toURL());
+ }
+
+ /**
+ * Test loading a configuration with a default 'authorize' definition
+ * which contains two roles.
+ */
+ public void testDefaultRoles() throws Exception
+ {
+ WSSecurityConfiguration wsConfig = load("jboss-wsse-default-roles.xml");
+
+ Config config = wsConfig.getDefaultConfig();
+ Authorize authorize = config.getAuthorize();
+ List<Role> roles = authorize.getRoles();
+
+ assertEquals("Expected 2 roles", 2, roles.size());
+
+ List<String> roleNames = new ArrayList<String>(roles.size());
+ for (Role current : roles)
+ {
+ roleNames.add(current.getName());
+ }
+ assertTrue("Expected 'Trader' role.", roleNames.contains("Trader"));
+ assertTrue("Expected 'Banker' role.", roleNames.contains("Banker"));
+ }
+
+}
Property changes on: stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1999/JBWS1999ConfigurationTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-default-roles.xml
===================================================================
--- stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-default-roles.xml (rev 0)
+++ stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-default-roles.xml 2008-12-18 18:06:14 UTC (rev 8956)
@@ -0,0 +1,12 @@
+<jboss-ws-security xmlns='http://www.jboss.com/ws-security/config'
+ xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
+ xsi:schemaLocation='http://www.jboss.com/ws-security/config http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd'>
+
+ <config>
+ <authorize>
+ <role>Banker</role>
+ <role>Trader</role>
+ </authorize>
+ </config>
+
+</jboss-ws-security>
\ No newline at end of file
Property changes on: stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-default-roles.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
16 years
JBossWS SVN: r8954 - in stack/native: tags and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2008-12-17 10:57:39 -0500 (Wed, 17 Dec 2008)
New Revision: 8954
Added:
stack/native/tags/jbossws-native-3.0.5.GA/
Removed:
stack/native/branches/jbossws-native-3.0.5/
Log:
[JBWS-2421] Tagging jbossws-native-3.0.5.GA
Copied: stack/native/tags/jbossws-native-3.0.5.GA (from rev 8953, stack/native/branches/jbossws-native-3.0.5)
16 years