CXF Client Security

后端 未结 4 2137
一整个雨季
一整个雨季 2021-02-15 15:23

I am creating a client to a Java soap web service, but am having trouble figuring out how to properly pass the password. Here is my \"hardcoded\" password exam

4条回答
  •  日久生厌
    2021-02-15 16:13

    Use PW_CALLBACK_REF instead PW_CALLBACK_CLASS, and pass an instantiated object, instead of the static class. You can inject the password in said object.

    Something like:

        outProps.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_TEXT);
        CXFClientPasswordHandler handler = new CXFClientPasswordHandler();
        handler.setPassword(password);
        outProps.put(WSHandlerConstants.PW_CALLBACK_REF, handler);
    

提交回复
热议问题