Hi,
I guess you miss my previous reply, just copy it here
It's expected behavior, you can't add same interceptor class(with
multiple different instances object) for a certain endpoint.
You need specify multiple action(standard in your term) like
UsernameToken, Encryption, Signature for one WSS4j interceptor.
If different service need different actions set, you just need use
different WSS4j interceptors with different actions set for each
service.
You should only use one WSS4JInInterceptor for a given cxf endpoint.
Your code should be like
Map<String,Object> inProps1= new HashMap<String,Object>();
inProps1
.put(WSHandlerConstants.ACTION,WSHandlerConstants.USERNAME_TOKEN + " "
+ WSHandlerConstants.ENCRYPT);
inProps1.put(WSHandlerConstants.PASSWORD_TYPE,
WSConstants.PASSWORD_DIGEST);
inProps1.put(WSHandlerConstants.PW_CALLBACK_CLASS,
ServerPasswordCallback.class.getName());
inProps1.put(WSHandlerConstants.DEC_PROP_FILE,
"Server_Decrypt.properties");
WSS4JInInterceptor wssIn1 = new WSS4JInInterceptor(inProps1);
cxfEndpoint.getInInterceptors().add(wssIn1);
With this code the WSS4JInInterceptor can handle both USERNAME_TOKEN
and ENCRYPT actions.
Freeman
On 2011-1-10, at 下午2:54, srinivas thallapalli wrote:
Hi,
I am using multiple interceptor in the following way
Map<String,Object> inProps1= new HashMap<String,Object>();
inProps1
.put(WSHandlerConstants.ACTION,WSHandlerConstants.USERNAME_TOKEN );
inProps1.put(WSHandlerConstants.PASSWORD_TYPE,
WSConstants.PASSWORD_DIGEST);
inProps1.put(WSHandlerConstants.PW_CALLBACK_CLASS,
ServerPasswordCallback.class.getName());
Map<String,Object> inProps2= new HashMap<String,Object>();
inProps2.put(WSHandlerConstants.ACTION,WSHandlerConstants.ENCRYPT);
inProps2.put(WSHandlerConstants.PW_CALLBACK_CLASS,
ServerPasswordCallback.class.getName());
inProps2.put(WSHandlerConstants.DEC_PROP_FILE,
"Server_Decrypt.properties");
WSS4JInInterceptor wssIn1 = new WSS4JInInterceptor(inProps1);
cxfEndpoint.getInInterceptors().add(wssIn1);
WSS4JInInterceptor wssIn2 = new WSS4JInInterceptor(inProps2);
cxfEndpoint.getInInterceptors().add(wssIn2);
So in the case only the first added intercpetor is effective, rest
of the
interceptors are not effective.
Thanks
--
View this message in context:
http://cxf.547215.n5.nabble.com/Problem-with-WSS4J-and-CXF-tp3331500p3334479.html
Sent from the cxf-user mailing list archive at Nabble.com.
--
Freeman Fang
------------------------
FuseSource: http://fusesource.com
blog: http://freemanfang.blogspot.com
twitter: http://twitter.com/freemanfang
Apache Servicemix:http://servicemix.apache.org
Apache Cxf: http://cxf.apache.org
Apache Karaf: http://karaf.apache.org
Apache Felix: http://felix.apache.org