[jboss-svn-commits] JBossWS SVN: r849 - in branches/jbossws-1.0/src/test: java/org/jboss/test/ws/samples/secureejb resources/samples/secureejb/META-INF resources/samples-override/secureejb/META-INF/wsdl
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Aug 28 12:27:43 EDT 2006
Author: thomas.diesler at jboss.com
Date: 2006-08-28 12:27:32 -0400 (Mon, 28 Aug 2006)
New Revision: 849
Modified:
branches/jbossws-1.0/src/test/java/org/jboss/test/ws/samples/secureejb/SecureEJBTestCase.java
branches/jbossws-1.0/src/test/resources/samples-override/secureejb/META-INF/wsdl/OrganizationService.wsdl
branches/jbossws-1.0/src/test/resources/samples/secureejb/META-INF/application-client.xml
branches/jbossws-1.0/src/test/resources/samples/secureejb/META-INF/ejb-jar.xml
branches/jbossws-1.0/src/test/resources/samples/secureejb/META-INF/jboss.xml
branches/jbossws-1.0/src/test/resources/samples/secureejb/META-INF/webservices.xml
Log:
Check CONFIDENTIAL access
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3963410
Modified: branches/jbossws-1.0/src/test/java/org/jboss/test/ws/samples/secureejb/SecureEJBTestCase.java
===================================================================
--- branches/jbossws-1.0/src/test/java/org/jboss/test/ws/samples/secureejb/SecureEJBTestCase.java 2006-08-28 15:30:49 UTC (rev 848)
+++ branches/jbossws-1.0/src/test/java/org/jboss/test/ws/samples/secureejb/SecureEJBTestCase.java 2006-08-28 16:27:32 UTC (rev 849)
@@ -102,11 +102,11 @@
InitialContext iniCtx = getInitialContext();
Service service = (Service)iniCtx.lookup("java:comp/env/service/BasicSecured");
QName portName = new QName("http://org.jboss.ws/samples/secureejb", "BasicSecuredPort");
- OrganizationService endpoint = (OrganizationService)service.getPort(portName, OrganizationService.class);
+ OrganizationService port = (OrganizationService)service.getPort(portName, OrganizationService.class);
try
{
- endpoint.getContactInfo("mafia");
+ port.getContactInfo("mafia");
fail("Security exception expected");
}
catch (RemoteException ignore)
@@ -114,11 +114,11 @@
// ignore expected exception
}
- Stub stub = (Stub)endpoint;
+ Stub stub = (Stub)port;
stub._setProperty(Stub.USERNAME_PROPERTY, USERNAME);
stub._setProperty(Stub.PASSWORD_PROPERTY, PASSWORD);
- String info = endpoint.getContactInfo("mafia");
+ String info = port.getContactInfo("mafia");
assertEquals("The 'mafia' boss is currently out of office, please call again.", info);
}
@@ -127,11 +127,11 @@
InitialContext iniCtx = getInitialContext();
Service service = (Service)iniCtx.lookup("java:comp/env/service/RoleSecured");
QName portName = new QName("http://org.jboss.ws/samples/secureejb", "RoleSecuredPort");
- OrganizationService endpoint = (OrganizationService)service.getPort(portName, OrganizationService.class);
+ OrganizationService port = (OrganizationService)service.getPort(portName, OrganizationService.class);
try
{
- endpoint.getContactInfo("mafia");
+ port.getContactInfo("mafia");
fail("Security exception expected");
}
catch (RemoteException ignore)
@@ -139,11 +139,40 @@
// ignore expected exception
}
- Stub stub = (Stub)endpoint;
+ Stub stub = (Stub)port;
stub._setProperty(Stub.USERNAME_PROPERTY, USERNAME);
stub._setProperty(Stub.PASSWORD_PROPERTY, PASSWORD);
- String info = endpoint.getContactInfo("mafia");
+ String info = port.getContactInfo("mafia");
assertEquals("The 'mafia' boss is currently out of office, please call again.", info);
}
+
+ public void testConfidentialServiceAccess() throws Exception
+ {
+ InitialContext iniCtx = getInitialContext();
+ Service service = (Service)iniCtx.lookup("java:comp/env/service/ConfidentialSecured");
+ QName portName = new QName("http://org.jboss.ws/samples/secureejb", "ConfidentialPort");
+ OrganizationService port = (OrganizationService)service.getPort(portName, OrganizationService.class);
+
+ Stub stub = (Stub)port;
+ String address = (String)stub._getProperty(Stub.ENDPOINT_ADDRESS_PROPERTY);
+ assertEquals("https://" + getServerHost() + ":8443/ws4ee-samples-ejb/ConfidentialSecured", address);
+
+ // test non-confidential access
+ try
+ {
+ stub._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, "http://" + getServerHost() + ":8080/ws4ee-samples-ejb/ConfidentialSecured");
+ port.getContactInfo("mafia");
+ fail("Security exception expected");
+ }
+ catch (RemoteException ignore)
+ {
+ // ignore expected exception
+ }
+
+ // test confidential access
+ //stub._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, "https://" + getServerHost() + ":8443/ws4ee-samples-ejb/ConfidentialSecured");
+ //String info = port.getContactInfo("mafia");
+ //assertEquals("The 'mafia' boss is currently out of office, please call again.", info);
+ }
}
Modified: branches/jbossws-1.0/src/test/resources/samples/secureejb/META-INF/application-client.xml
===================================================================
--- branches/jbossws-1.0/src/test/resources/samples/secureejb/META-INF/application-client.xml 2006-08-28 15:30:49 UTC (rev 848)
+++ branches/jbossws-1.0/src/test/resources/samples/secureejb/META-INF/application-client.xml 2006-08-28 16:27:32 UTC (rev 849)
@@ -19,5 +19,11 @@
<wsdl-file>META-INF/wsdl/OrganizationService.wsdl</wsdl-file>
<jaxrpc-mapping-file>META-INF/jaxrpc-mapping.xml</jaxrpc-mapping-file>
</service-ref>
+ <service-ref>
+ <service-ref-name>service/ConfidentialSecured</service-ref-name>
+ <service-interface>javax.xml.rpc.Service</service-interface>
+ <wsdl-file>META-INF/wsdl/OrganizationService.wsdl</wsdl-file>
+ <jaxrpc-mapping-file>META-INF/jaxrpc-mapping.xml</jaxrpc-mapping-file>
+ </service-ref>
</application-client>
Modified: branches/jbossws-1.0/src/test/resources/samples/secureejb/META-INF/ejb-jar.xml
===================================================================
--- branches/jbossws-1.0/src/test/resources/samples/secureejb/META-INF/ejb-jar.xml 2006-08-28 15:30:49 UTC (rev 848)
+++ branches/jbossws-1.0/src/test/resources/samples/secureejb/META-INF/ejb-jar.xml 2006-08-28 16:27:32 UTC (rev 849)
@@ -27,6 +27,15 @@
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
+ <session>
+ <ejb-name>ConfidentialSLSB</ejb-name>
+ <remote>org.jboss.test.ws.samples.secureejb.OrganizationRemote</remote>
+ <home>org.jboss.test.ws.samples.secureejb.OrganizationHome</home>
+ <service-endpoint>org.jboss.test.ws.samples.secureejb.OrganizationService</service-endpoint>
+ <ejb-class>org.jboss.test.ws.samples.secureejb.OrganizationImpl</ejb-class>
+ <session-type>Stateless</session-type>
+ <transaction-type>Container</transaction-type>
+ </session>
</enterprise-beans>
<assembly-descriptor>
@@ -47,6 +56,13 @@
<method-name>*</method-name>
</method>
</method-permission>
+ <method-permission>
+ <unchecked/>
+ <method>
+ <ejb-name>ConfidentialSLSB</ejb-name>
+ <method-name>*</method-name>
+ </method>
+ </method-permission>
</assembly-descriptor>
</ejb-jar>
Modified: branches/jbossws-1.0/src/test/resources/samples/secureejb/META-INF/jboss.xml
===================================================================
--- branches/jbossws-1.0/src/test/resources/samples/secureejb/META-INF/jboss.xml 2006-08-28 15:30:49 UTC (rev 848)
+++ branches/jbossws-1.0/src/test/resources/samples/secureejb/META-INF/jboss.xml 2006-08-28 16:27:32 UTC (rev 849)
@@ -28,5 +28,14 @@
<transport-guarantee>NONE</transport-guarantee>
</port-component>
</session>
+ <session>
+ <ejb-name>ConfidentialSLSB</ejb-name>
+ <jndi-name>ejb/ConfidentialSLSB</jndi-name>
+ <port-component>
+ <port-component-name>ConfidentialSecured</port-component-name>
+ <port-component-uri>/ws4ee-samples-ejb/ConfidentialSecured</port-component-uri>
+ <transport-guarantee>CONFIDENTIAL</transport-guarantee>
+ </port-component>
+ </session>
</enterprise-beans>
</jboss>
Modified: branches/jbossws-1.0/src/test/resources/samples/secureejb/META-INF/webservices.xml
===================================================================
--- branches/jbossws-1.0/src/test/resources/samples/secureejb/META-INF/webservices.xml 2006-08-28 15:30:49 UTC (rev 848)
+++ branches/jbossws-1.0/src/test/resources/samples/secureejb/META-INF/webservices.xml 2006-08-28 16:27:32 UTC (rev 849)
@@ -26,5 +26,13 @@
<ejb-link>BasicSecuredSLSB</ejb-link>
</service-impl-bean>
</port-component>
+ <port-component>
+ <port-component-name>ConfidentialSecured</port-component-name>
+ <wsdl-port>impl:ConfidentialPort</wsdl-port>
+ <service-endpoint-interface>org.jboss.test.ws.samples.secureejb.OrganizationService</service-endpoint-interface>
+ <service-impl-bean>
+ <ejb-link>ConfidentialSLSB</ejb-link>
+ </service-impl-bean>
+ </port-component>
</webservice-description>
</webservices>
Modified: branches/jbossws-1.0/src/test/resources/samples-override/secureejb/META-INF/wsdl/OrganizationService.wsdl
===================================================================
--- branches/jbossws-1.0/src/test/resources/samples-override/secureejb/META-INF/wsdl/OrganizationService.wsdl 2006-08-28 15:30:49 UTC (rev 848)
+++ branches/jbossws-1.0/src/test/resources/samples-override/secureejb/META-INF/wsdl/OrganizationService.wsdl 2006-08-28 16:27:32 UTC (rev 849)
@@ -32,5 +32,8 @@
<port name="RoleSecuredPort" binding="tns:OrganizationServiceBinding">
<soap:address location="http://@jbosstest.host.name@:8080/ws4ee-samples-ejb/RoleSecured"/>
</port>
+ <port name="ConfidentialPort" binding="tns:OrganizationServiceBinding">
+ <soap:address location="https://@jbosstest.host.name@:8443/ws4ee-samples-ejb/ConfidentialSecured"/>
+ </port>
</service>
</definitions>
\ No newline at end of file
More information about the jboss-svn-commits
mailing list