On Friday 19 November 2010 12:57:43 pm mamerkashi wrote:
> Daniel,
> 
> Great, and thanks. That worked, but I don't understand why the key and
> value should be the same??  Can you please provide a little explanation?
> Thanks

Well, they don't really.    WSS4J first looks for something with the 
"passwordCallbackClass" key and casts that to a String.  If that is null, it 
then looks for something with a "passwordCallbackRef" and casts that to the 
CallbackHandler.   

Thus, the value just needs to be of the right type.  (string for one, a 
Callback object for the other).     You could have inlined the callback:


<bean id="wss4jInInterceptorServer" 
class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor"> 
        <constructor-arg> 
            <map> 
                <entry key="action" value="UsernameToken"/> 
                <entry key="passwordType" value="PasswordText"/> 
                <entry key="passwordCallbackRef"> 
                    <bean class="com.myCompany.security.MyPasswordCallback"> 
                        <property name="key1" value="value1"/> 
                        <property name="key2" value="value2"/> 
                     </bean> 
                 </entry>
            </map> 
        </constructor-arg> 
    </bean> 

and it would have been fine as well.


-- 
Daniel Kulp
[email protected]
http://dankulp.com/blog

Reply via email to