You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by di...@gmail.com on 2009/11/11 04:23:20 UTC

Remove

Remove

-----Original Message-----
From: Prabath Siriwardena [mailto:prabath@wso2.com] 
Sent: Tuesday, November 10, 2009 10:10 PM
To: axis-user@ws.apache.org
Subject: Re: Axis2/Java 1.5.1 and Rampart

Hi;

Following will be helpful.

Load the policy :

StAXOMBuilder builder = new StAXOMBuilder("policy.xml");
Policy policy = PolicyEngine.getPolicy(builder.getDocumentElement());

Get the Options from the Stub :

ServiceClient client = stub._getServiceClient();
Options option = client.getOptions();

Set the policy :

options.setProperty(RampartMessageData.KEY_RAMPART_POLICY, policy);

Thanks & regards.
-Prabath

stefangeelen@hotmail.com wrote:
> Hi,
>
> thanks for the reply.
>
> I'll create a JIRA on this.
>
> Question: How can I attach the policy file to the client ? Any
documentation/examples 
>
> Regards,
>
> S.
>
> Prabath Siriwardena-2 wrote:
>   
>> Please create a JIRA on the issue.
>>
>> Alternatively you can attach the policy file to the client to get the 
>> expected results.
>>
>> Thanks & regards.
>> -Prabath
>>
>> SGE0 wrote:
>>     
>>> Hi, 
>>>
>>> we have following services.xml file (part):
>>>
>>> <service name="Upload" scope="application">
>>>      ...
>>>
>>>   	<module ref="rampart" />
>>> <wsp:Policy wsu:Id="UsernameToken" xmlns:wsu=
>>>    
>>>
"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-
1.0.xsd"
>>>     xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
>>>   <wsp:ExactlyOne>
>>>     <wsp:All>
>>>       <sp:SupportingTokens
>>>          
>>> xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702">
>>>         <wsp:Policy>
>>>           <sp:UsernameToken sp:IncludeToken=
>>>              
>>>
"http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/Alwa
ysToRecipient">
>>>              
>>>             <wsp:Policy>
>>>               <sp:HashPassword/>
>>>             </wsp:Policy>
>>>            
>>>           </sp:UsernameToken>
>>>         </wsp:Policy>
>>>       </sp:SupportingTokens>
>>>
>>>       <ramp:RampartConfig
>>> xmlns:ramp="http://ws.apache.org/rampart/policy">
>>>        
>>>
<ramp:passwordCallbackClass>...security.PWCBHandler</ramp:passwordCallbackCl
ass>
>>>       </ramp:RampartConfig>
>>>
>>>     </wsp:All>
>>>   </wsp:ExactlyOne>
>>> </wsp:Policy>
>>> </service>
>>>
>>>
>>> When we generate  the client stub with Java2WSDL we see that the 
>>>             <wsp:Policy>
>>>               <sp:HashPassword/>
>>>             </wsp:Policy>
>>> is not correctly generated. 
>>>
>>> When we look at the populateAxisService method in the generated stub we
>>> see:
>>>
>>>   private void populateAxisService() throws org.apache.axis2.AxisFault {
>>>
>>> ...
>>> 	    
>>> 	   
>>>
(__operation).getMessage(org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_O
UT_VALUE).getPolicySubject().attachPolicy(getPolicy("<wsp:Policy
>>>
xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\"><wsp:ExactlyOne><
wsp:All><sp:SupportingTokens
>>>
xmlns:sp=\"http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702\"><wsp:
Policy><sp:UsernameToken
>>> xmlns:sp=\"http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702\"
>>>
sp:IncludeToken=\"http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/
IncludeToken/AlwaysToRecipient\"
>>> /></wsp:Policy></sp:SupportingTokens><sp:SupportingTokens
>>>
xmlns:sp=\"http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702\"><wsp:
Policy><sp:UsernameToken
>>> xmlns:sp=\"http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702\"
>>>
sp:IncludeToken=\"http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/
IncludeToken/AlwaysToRecipient\"
>>>
/></wsp:Policy></sp:SupportingTokens></wsp:All></wsp:ExactlyOne></wsp:Policy
>"));
>>> 	    
>>> ...    
>>>         
>>>         }
>>>
>>>
>>> The result is that we can send over a plain text userid/pwd but not a
>>> hashed
>>> password.
>>>
>>> Anyone experiencing the same problem ?
>>>
>>> S.
>>>   
>>>       
>>
>>     
> Quoted from: 
>
http://old.nabble.com/Axis2-Java-1.5.1-and-Rampart-tp26269867p26283140.html
>
>
>