users@jax-rpc.java.net

Re: Security

From: Eschini Renato <renato.eschini_at_TIN.IT>
Date: Fri, 30 Aug 2002 11:47:38 +0200

----- Original Message -----
From: "Arun Gupta" <Arun.Gupta_at_SUN.COM>
To: <JAXRPC-INTEREST_at_JAVA.SUN.COM>
Sent: Friday, August 30, 2002 5:21 AM
Subject: Re: Security


> Hi Renato,
>
> To realize basic authentication for JAX-RPC based application under Tomcat,
do
> the following:
>
> 1). Change your client code to add the following properties to your stub
> - yourStub._setProperty(Stub.USERNAME_PROPERTY, your_username);
> - yourStub._setProperty(Stub.PASSWORD_PROPERTY, your_password);
> 3). Edit conf/tomcat-users.xml to create an entry:
> <user name="your_username" password="your_password" roles="your_role"/>
>
> Now all invocations from your stub are dispatched correctly on the server
side
> if the USERNAME_PROPERTY and PASSWORD_PROPERTY specified in your stub
matches
> the properties specified in conf/tomcat-users.xml.

Thanks for your interest about me,I made my code modify after the stub._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY,my_endpoint);
in this way:
stub._setProperty(Stub.USERNAME_PROPERTY,"my_username");
stub._setProperty(Stub.PASSWORD_PROPERTY,"my_password");

but I encountered this problem on the client console when the client runs
(I'm developing with ant under jbuilder7):

           [echo] Running the mypackage.servicesClient program....
           [java] java.rmi.RemoteException: HTTP transport error: javax.xml.soap.SOAPException:
Absent Content-Type; nested exception is:
           [java] HTTP transport error: javax.xml.soap.SOAPException:
Absent Content-Type
           [java] HTTP transport error: javax.xml.soap.SOAPException: Absent
Content-Type
           [java] at com.sun.xml.rpc.client.http.HttpClientTransport.invoke(HttpClientTransport.java:189)
           [java] at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:73)
           [java] at com.synapsis.webservicesctm.servicesCTMIF_Stub.e_mail(Unknown
Source)
           [java] at com.synapsis.webservicesctm.servicesCTMClient.main(Unknown
Source)
           [java]
           [java] CAUSE:
           [java]
           [java] javax.xml.soap.SOAPException: Absent Content-Type
           [java] at com.sun.xml.messaging.saaj.soap.MessageImpl.<init>(MessageImpl.java:86)
           [java] at com.sun.xml.messaging.saaj.soap.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:32)
           [java] at com.sun.xml.rpc.client.http.HttpClientTransport.invoke(HttpClientTransport.java:156)
           [java] at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:73)
           [java] at mypackage.servicesIF_Stub.e_mail(Unknown Source)
           [java] at mypackage.servicesClient.main(Unknown Source)

This is my web.xml part about security, is that ok?

<security-constraint>
        <web-resource-collection>
            <web-resource-name>My service name</web-resource-name>
            <url-pattern>/*</url-pattern>
            <http-method>GET</http-method>
            <http-method>POST</http-method>
        </web-resource-collection>
        <auth-constraint>
            <role-name>my_role</role-name>
        </auth-constraint>
        <user-data-constraint>
            <transport-guarantee>NONE</transport-guarantee>
        </user-data-constraint>
</security-constraint>

I have edited my conf/tomcat-users.xml to create an entry like
    <user name="my_username" password="my_password" roles="my_role"/>

In the server-side on tomcat console I'haven't any error message, so I tried
to point my browser at http://localhost:8080/WebServices/jaxrpc and I haven't
the normal message about the service but I recive this message in the browser:

Apache Tomcat/4.0.3 - HTTP Status 500 - Configuration error: Cannot perform
access control without an authenticated principal
type Status report
message Configuration error: Cannot perform access control without an authenticated
principal
description The server encountered an internal error (Configuration error:
Cannot perform access control without an authenticated principal) that prevented
it from fulfilling this request.

Thanks again for your time


Ciao,
 Renato
--------------------------------------------------------
Synapsis S.r.l.
     in Computer Science

P.zza Dante, 19/20
57121 Livorno Italy
tel: 0586 426790
fax: 0586 443954
www.websynapsis.com

You can find me at
e-mail:r.eschini_at_websynapsis.com
msn account:r_eschini_at_hotmail.com
web:www.cli.di.unipi.it/~eschini
--------------------------------------------------------