You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by srinivas thallapalli <sr...@gmail.com> on 2010/12/14 07:18:48 UTC

Problem with WSS4J and CXF

Hi,

I am working on applying ws-security for my cxf service using wss4j, to
enable encrption
trying to pass crypto properties with java.util.Properties to
WSHandlerConstants.ENC_PROP_REF_ID
as below, but it gives ClassCastException, could anybody please let me know
any thing wrong this approach.

outProps.put(WSHandlerConstants.ACTION, "Encrypt");
outProps.put(WSHandlerConstants.ENCRYPTION_USER, "serverx509v2");
outProps.put(WSHandlerConstants.ENC_PROP_REF_ID, propertiesobject);

WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);


Thanks
-- 
View this message in context: http://cxf.547215.n5.nabble.com/Problem-with-WSS4J-and-CXF-tp3304120p3304120.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Problem with WSS4J and CXF

Posted by srinivas thallapalli <sr...@gmail.com>.
Hi dvaleri,

Thanks for the reply 
-- 
View this message in context: http://cxf.547215.n5.nabble.com/Problem-with-WSS4J-and-CXF-tp3304120p3306244.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Problem with WSS4J and CXF

Posted by David Valeri <dv...@apache.org>.
There are actually two layers of indirection there.  So
WSHandlerConstants.ENC_PROP_REF_ID should specify a string value naming
another entry in the Map you pass to the interceptor constructor.  This
named entry should have the actual java.util.Properties Object as its value.

See lines 95-101 of this example [1] to see how it is done for a signature
crypto properties.  Line 101 refers to the actual Properties object defined
on line 140.  The process is pretty much the same for encryption
properties.  You would have something like the following:

outProps.put(WSHandlerConstants.ENC_PROP_REF_ID, "myPropertyName");
outProps.put("myPropertyName", propertiesobject);

[1]
http://code.google.com/p/davidvaleri/source/browse/projects/examples/cxf-wsa-sig/tags/cxf-wsa-sig-1.0/src/test/resources/valeri/blog/examples/cxf_wsa_sig/service-context.xml?r=237

On Tue, Dec 14, 2010 at 1:18 AM, srinivas thallapalli <
sree.tallapalli@gmail.com> wrote:

>
> Hi,
>
> I am working on applying ws-security for my cxf service using wss4j, to
> enable encrption
> trying to pass crypto properties with java.util.Properties to
> WSHandlerConstants.ENC_PROP_REF_ID
> as below, but it gives ClassCastException, could anybody please let me know
> any thing wrong this approach.
>
> outProps.put(WSHandlerConstants.ACTION, "Encrypt");
> outProps.put(WSHandlerConstants.ENCRYPTION_USER, "serverx509v2");
> outProps.put(WSHandlerConstants.ENC_PROP_REF_ID, propertiesobject);
>
> WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);
>
>
> Thanks
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/Problem-with-WSS4J-and-CXF-tp3304120p3304120.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>