On Jun 11, 2008, at 12:21 AM, Glen Mazza wrote:

If you are talking about a standalone web service (one not hosted on a
servlet container), maybe com.sun.net.HttpsServer[1] can help you here
(I've never used it before though.)  See [2], "Take Control of the
Underlying HTTP Server" section at the bottom.

(Anybody know if CXF has an equivalent for this?)

Kind of. We use jetty for our http server when we need to bring up a service as a standalone service like this. I honestly don't know how to configure the embedded jetty instance to handle the user mapping stuff itself. We have configuration that allows adding handlers to the jetty instance, but I haven't delved into the jetty capabilities enough to figure out what handlers would be needed.

The other alternative is to write a CXF interceptor that grabs the username/password from the Message and authenticate it with whatever authentication mechanism you use. This isn't much work.

Dan







HTH,
Glen

[1]
http://java.sun.com/javase/6/docs/jre/api/net/httpserver/spec/index.html?com/sun/net/httpserver/HttpsServer.html
[2]
http://today.java.net/pub/a/today/2007/07/03/jax-ws-web-services-without-ee-containers.html



2008-06-11 M.A.Bednarz wrote:
Hello Glen !

Thanks, this works and is a good solution for tomcat. But I am looking for a
direct soltion. Any other idea?

Maciek

2008/6/11 Glen Mazza <[EMAIL PROTECTED]>:


Perhaps this can help you: http://www.jroller.com/gmazza/date/20080605

HTH,
Glen


M.A.Bednarz wrote:

Hello !

Is there an expert who can give me a hint how to configure ssl and basic authentication in combination? I have a working ssl engine- factory so far
and
need to activate basic authentication for my service. My source for a
spring
started configuration is this:

public class SpringServiceServer {
   public static void main(String[] args) throws Exception {
       ApplicationContext applicationContext = new
ClassPathXmlApplicationContext(
               new String[] { "springcxf.xml" });
       System.in.read();
   }
}

--- springcxf.xml ---

<beans xmlns="http://www.springframework.org/schema/beans";
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
   xmlns:sec="http://cxf.apache.org/configuration/security";
   xmlns:jaxws="http://cxf.apache.org/jaxws";
   xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
             http://cxf.apache.org/configuration/security
http://cxf.apache.org/schemas/configuration/security.xsd
           http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd";>

   <import resource="classpath:server.cxf" />
   <import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension- soap.xml" /> <import resource="classpath:META-INF/cxf/cxf-extension- http.xml" />
   <import
resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml"
/>

   <jaxws:endpoint id="customerService"
       implementor="CustomerServiceImpl" address="
https://localhost:9001/CustomerService";>
   </jaxws:endpoint>

</beans>

--- server.cxf ---

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans";
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
   xmlns:sec="http://cxf.apache.org/configuration/security";
   xmlns:http="http://cxf.apache.org/transports/http/configuration";

xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration "
   xmlns:jaxws="http://java.sun.com/xml/ns/jaxws";
   xsi:schemaLocation="
      http://cxf.apache.org/configuration/security
      http://cxf.apache.org/schemas/configuration/security.xsd
           http://cxf.apache.org/transports/http/configuration
http://cxf.apache.org/schemas/configuration/http- conf.xsd http://cxf.apache.org/transports/http-jetty/ configuration
           http://cxf.apache.org/schemas/configuration/http-jetty.xsd
           http://www.springframework.org/schema/beans

http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
">

   <httpj:engine-factory bus="cxf">
       <httpj:engine port="9001">
           <httpj:tlsServerParameters>
               <sec:keyManagers keyPassword="secret">
                   <sec:keyStore type="JKS" password="secret"
                       file="doc/keystore" />
               </sec:keyManagers>
               <sec:trustManagers>
                   <sec:keyStore type="JKS" password="secret"
                       file="doc/keystore" />
               </sec:trustManagers>
           </httpj:tlsServerParameters>
       </httpj:engine>
   </httpj:engine-factory>

   <!-- We need a bean named "cxf" -->
   <bean id="cxf" class="org.apache.cxf.bus.CXFBusImpl"/>

</beans>


What I need is that a client has to login before can even see the wsdl. I tried to use a http-conduit but there is no effect I only get the https
page
but no login box :-(((

Thank you very much for any help,

Maciek



--
View this message in context:
http://www.nabble.com/Help-needed-for-SSL-and-Basic-authentication-tp17761832p17766917.html
Sent from the cxf-user mailing list archive at Nabble.com.




---
Daniel Kulp
[EMAIL PROTECTED]
http://www.dankulp.com/blog




Reply via email to